Time for action – the Game1 Update method
Replace the current
Update()
method in theGame1
class with the following:Protected Overrides Sub Update(gameTime As GameTime) Camera.Position = new Vector2(hscroll.Value, vscroll.Value) Dim ms As MouseState = Mouse.GetState() if ((ms.X > 0) And (ms.Y > 0) And(ms.X < Camera.ViewPortWidth) And(ms.Y < Camera.ViewPortHeight)) Then Dim mouseLoc As Vector2 = Camera.ScreenToWorld(new Vector2(ms.X, ms.Y)) If Camera.WorldRectangle.Contains(CInt(mouseLoc.X), CInt(mouseLoc.Y)) Then If ms.LeftButton = ButtonState.Pressed Then TileMap.SetTileAtCell(TileMap.GetCellByPixelX(CInt(mouseLoc.X)), TileMap.GetCellByPixelY(CInt(mouseLoc.Y)), DrawLayer, DrawTile) End If If (ms.RightButton = ButtonState.Pressed) And(lastMouseState.RightButton = ButtonState.Released) Then If EditingCode Then TileMap.GetMapSquareAtCell(TileMap.GetCellByPixelX(CInt(mouseLoc.X)), ...