Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class PacmanActor
- Private ReadOnly m_PacmanLabel As Label
- Private ReadOnly m_Field As Panel
- Private m_Done As Boolean
- Private m_Rule As MovementRule
- Public Property Coordinates() As Point
- Get
- Return m_PacmanLabel.Location
- End Get
- Set(ByVal value As Point)
- m_PacmanLabel.Location = value
- End Set
- End Property
- Public ReadOnly Property Done() As Boolean
- Get
- Return m_Done
- End Get
- End Property
- Public Sub New(aField As Panel)
- m_PacmanLabel = New Label()
- m_PacmanLabel.Text = "O<"
- m_PacmanLabel.Visible = False
- m_Field = aField
- m_Done = False
- End Sub
- Public Sub StartUp(aCoordinates As Point, aRule As MovementRule)
- m_PacmanLabel.Location = aCoordinates
- m_Done = False
- m_Field.Controls.Add(m_PacmanLabel)
- m_PacmanLabel.Visible = True
- m_Rule = aRule
- End Sub
- Public Sub ShutDown()
- m_PacmanLabel.Visible = False
- m_Field.Controls.Remove(m_PacmanLabel)
- End Sub
- Public Sub Move()
- If Not m_Done Then
- Dim lNewCoords As Point
- m_Done = Not m_Rule.Evaluate(m_PacmanLabel.Location, lNewCoords)
- If Not m_Done Then
- m_PacmanLabel.Location = lNewCoords
- Application.DoEvents()
- End If
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement