Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Structure Lobject ' The main objects in the game
- Dim size As System.Drawing.Color 'Magnitude of the object bassed on colour
- Dim links() As link 'links to other objects
- Dim position As Point 'position in the map
- Dim velocity As vector 'velocity
- Dim visible As PictureBox 'The picturebox to show the object
- Dim myref As Int16 ' a reference to itself
- End Structure
- Public Structure link 'The data type to explain links between objects
- Dim reference As Integer 'Reference to the other object
- Dim distance As Integer 'The distance must stay constant and so this is saved
- End Structure
- Public Structure vector
- Dim x As Integer 'Velocity in the X axis
- Dim y As Integer 'Velocity in the Y axis
- End Structure
- Dim ObjectList(2) As Lobject
- Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
- BRun.Enabled = False
- Me.Refresh()
- 'set up each object
- For i = 0 To 2
- ObjectList(i).position = New Point(i * 100 + 100, 100)
- ObjectList(i).size = System.Drawing.Color.FromArgb(0, 0, 255)
- ObjectList(i).myref = i
- ObjectList(i).velocity.x = 0
- ObjectList(i).velocity.y = 0
- ObjectList(i).visible = New PictureBox
- ObjectList(i).visible.Name = "object#" & i
- ObjectList(i).visible.Parent = Me
- ObjectList(i).visible.Left = 10 * i
- ObjectList(i).visible.Top = 10 * i
- ObjectList(i).visible.Visible = True 'Confusing but the fist visible is of type picturebox and so has the attribute visible
- ObjectList(i).visible.Height = 50
- ObjectList(i).visible.Width = 50
- 'ObjectList(i).visible.BackColor = Color.FromArgb(255, 255, 255 - 30 * i)
- Next
- MsgBox("")
- BRun.Enabled = True
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment