jhylands

Large user defined type

Aug 11th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.89 KB | None | 0 0
  1.     Public Structure Lobject ' The main objects in the game
  2.         Dim size As System.Drawing.Color 'Magnitude of the object bassed on colour
  3.         Dim links() As link 'links to other objects
  4.         Dim position As Point 'position in the map
  5.         Dim velocity As vector 'velocity
  6.         Dim visible As PictureBox 'The picturebox to show the object
  7.         Dim myref As Int16 ' a reference to itself
  8.     End Structure
  9.     Public Structure link 'The data type to explain links between objects
  10.         Dim reference As Integer 'Reference to the other object
  11.         Dim distance As Integer 'The distance must stay constant and so this is saved
  12.     End Structure
  13.     Public Structure vector
  14.         Dim x As Integer 'Velocity in the X axis
  15.         Dim y As Integer 'Velocity in the Y axis
  16.     End Structure
  17.     Dim ObjectList(2) As Lobject
  18.  
  19.  
  20.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  21.         BRun.Enabled = False
  22.         Me.Refresh()
  23.         'set up each object
  24.         For i = 0 To 2
  25.             ObjectList(i).position = New Point(i * 100 + 100, 100)
  26.             ObjectList(i).size = System.Drawing.Color.FromArgb(0, 0, 255)
  27.             ObjectList(i).myref = i
  28.             ObjectList(i).velocity.x = 0
  29.             ObjectList(i).velocity.y = 0
  30.             ObjectList(i).visible = New PictureBox
  31.             ObjectList(i).visible.Name = "object#" & i
  32.             ObjectList(i).visible.Parent = Me
  33.             ObjectList(i).visible.Left = 10 * i
  34.             ObjectList(i).visible.Top = 10 * i
  35.             ObjectList(i).visible.Visible = True 'Confusing but the fist visible is of type picturebox and so has the attribute visible
  36.             ObjectList(i).visible.Height = 50
  37.             ObjectList(i).visible.Width = 50
  38.             'ObjectList(i).visible.BackColor = Color.FromArgb(255, 255, 255 - 30 * i)
  39.  
  40.         Next
  41.         MsgBox("")
  42.         BRun.Enabled = True
  43.  
  44.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment