Before we work on getting those Floaters to work, first we are going to set up the lava collections. So, you may know the procedure by now. First we declare the ArrayList of Lava in the declarations.
Dim Lavas As ArrayList 'Holds all of the lava pools for this level. |
Lava = Rectangle.FromLTRB(210, 520, 270, LANDHEIGHT) 'Initialize the lava location. |
Lavas = New ArrayList(20) 'Create the arraylist. Lavas.Add(Rectangle.FromLTRB(210, 520, 270, LANDHEIGHT)) 'Initialize the lava location. |
For Each Lava In Lavas GFX.FillRectangle(LavaBrsh, Lava) GFX.DrawRectangle(Pens.Red, Lava) 'The translucent lava will be drawn with a red box around the border. Next |
For Each Lava In Lavas If Lava.IntersectsWith(PlayerLoc) Then IsGoner = True 'The player steps into lava. Lose a life. PlayerVeloc = SBARINITIALVELOCITY End If Next |
ElseIf e.KeyCode = Keys.L Then If Not IsMouseDown Then MDObject = "L"c End If |
Case "L"c Placed = Rectangle.FromLTRB(Math.Min(InitialPt.X, Mu.X), Math.Min(InitialPt.Y, Mu.Y), Math.Max(InitialPt.X, Mu.X), Math.Max(InitialPt.Y, Mu.Y)) Lavas.Insert(0, Placed) 'Add a lava. |
'Next, lava is written to file BW.Write(Lavas.Count) 'And then, each lava is written. For Each Lava In Lavas BW.Write(Lava.Left) BW.Write(Lava.Top) BW.Write(Lava.Right) BW.Write(Lava.Bottom) Next |
Lavas = New ArrayList(20) 'Create the arraylist. Lavas.Add(Rectangle.FromLTRB(210, 520, 270, LANDHEIGHT)) 'Initialize the lava location. |
Lavas = New ArrayList(BR.ReadInt32()) For LV = 1 To Lavas.Capacity Lavas.Add(Rectangle.FromLTRB(BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32())) 'Read the lavas into the file. Next |
'Before we run the rest of this sub, let's get a filename. Dim SFD As SaveFileDialog = New SaveFileDialog SFD.Filter = "Data Files|*.dat" SFD.InitialDirectory = Application.StartupPath SFD.OverwritePrompt = True SFD.Title = "Select the location where this level will be saved." If SFD.ShowDialog() = DialogResult.OK Then |
Private Sub LoadLevel(ByVal Filename As String) |
LoadLevel(Application.StartupPath & "\level.dat") 'Loads the information for this level. |