First, there is a bug that I did not address in the last episode. The character gets killed if you ride a lift going down. So, we'll just add this quick check in place
For Each MobileWall In MobileWalls If PlayerLoc.IntersectsWith(MobileWall.Loc) AndAlso MobileWalls.IndexOf(MobileWall) <> R Then IsGoner = True 'The player has been smushed. Lose a life. PlayerVeloc = SBARINITIALVELOCITY End If Next MobileWall = DirectCast(MobileWalls(R), MovingWall) |
'Moving walls written to file. BW.Write(MobileWalls.Count) For Each MobileWall In MobileWalls BW.Write(MobileWall.Loc.Left) BW.Write(MobileWall.Loc.Top) BW.Write(MobileWall.Loc.Right) BW.Write(MobileWall.Loc.Bottom) BW.Write(MobileWall.dX) BW.Write(MobileWall.dY) BW.Write(MobileWall.Boundary.Left) BW.Write(MobileWall.Boundary.Top) BW.Write(MobileWall.Boundary.Right) BW.Write(MobileWall.Boundary.Bottom) Next |
MobileWalls = New ArrayList(BR.ReadInt32) For LV = 1 To MobileWalls.Capacity MobileWalls.Add(New MovingWall(Rectangle.FromLTRB(BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32()), _ BR.ReadInt32(), BR.ReadInt32(), _ Rectangle.FromLTRB(BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32(), BR.ReadInt32()))) 'Moving wall data from file. Next |
ElseIf e.KeyCode = Keys.M Then If Not IsMouseDown Then MDObject = "M"c End If |
Case "M"c If MemoryRect.IsEmpty Then MemoryRect = Placed Else Dim Mw As MovingWall 'Will hold the data that we are about to collect. Clock.Enabled = False 'Stop timed execution. If Placed.Width > MemoryRect.Width Then 'Placed is bigger, therefore it must be the boundary. Mw.Boundary = Placed Mw.Loc = MemoryRect Else 'Placed is smaller, it must be the actual wall. Mw.Boundary = MemoryRect Mw.Loc = Placed End If Mw.dX = NumericBox.Show(-24, 24, "X Velocity") Mw.dY = NumericBox.Show(-24, 24, "Y Velocity") 'Set the wall velocity. MobileWalls.Insert(0, Mw) 'Add it to our list of moving wall. Clock.Enabled = True 'continue timed execution. End If |