-4
私は視覚的なスタジオを使ってビジュアルベーシックなテキストベースのゲームに取り組んでいます。私はかなり間違っていると思います。変数が自分のイベントの1つに渡されていないので、イベントが実行されると、0で満たされます。私は周りを見回して修正を見つけましたが、初心者のために私が何をすることができるかわからないからです。ここで何が間違っているのか分かりません - 私は初心者です
EDITED: HERESにコード
Public Class Entity
Private ename As String
Private esymbol As Char
Private ecolor As ConsoleColor
Private ex As Integer
Private ey As Integer
Public Property name() As String
Get
Return ename
End Get
Set(ByVal value As String)
ename = value
End Set
End Property
Public Property symbol() As Char
Get
Return esymbol
End Get
Set(ByVal value As Char)
esymbol = value
End Set
End Property
Public Property color() As ConsoleColor
Get
Return ecolor
End Get
Set(ByVal value As ConsoleColor)
ecolor = value
End Set
End Property
Public Property x() As Integer
Get
Return ex
End Get
Set(ByVal value As Integer)
ex = value
End Set
End Property
Public Property y() As Integer
Get
Return ey
End Get
Set(ByVal value As Integer)
ey = value
End Set
End Property
Public Sub New(ByVal ename As String, ByVal esymbol As Char, ByVal ecolor As ConsoleColor, ByVal ex As Integer, ByVal ey As Integer)
ename = name
esymbol = symbol
ecolor = color
ex = x
ey = y
End Sub
End Class
Public Class Adventurer
Inherits Entity
Public Sub New(ByVal name As String, ByVal x As Integer, ByVal y As Integer)
MyBase.New(name, "@", ConsoleColor.Magenta, x, y)
End Sub
End Class
Module VbQuest
Public Sub Main()
Console.Title = "VB Quest"
Console.SetWindowSize(80, 35)
Console.Clear()
Console.WriteLine("Welcome to VB Quest!")
Console.WriteLine("What is your name?")
Console.Write(">")
Dim name As String = Console.ReadLine()
Static player = New Adventurer(name, 1, 1)
Console.Clear()
DrawPlayer(player)
Console.ReadKey()
End Sub
Sub DrawPlayer(ByVal player As Entity)
Console.SetCursorPosition(player.x, player.y)
Console.ForegroundColor = player.color
Console.Write(player.symbol)
Console.ResetColor()
End Sub
End Module
から
変更、それを(http://stackoverflow.com/help/how-to-ask) – tkausl
Hiyaを[尋ねる方法]! Stack Overflowへようこそ - あなたの質問にコードを投稿できますか(スクリーンショットではなく書式付きのテキストとして)? [mcve]を形成するために、できるだけ多くの無関係なものを取り除く必要があります。これを行う際にあなた自身の問題を解決することがよくあります。 –
ゲッターやセッターで何かをしない限り、無関係なものを取り除く助けとして、プロパティは自動プロパティでなければなりません。 y = yで問題がある場合は、me.y = yを使用してください – jmoreno