Time for action – the Game1 Update method
Replace the current
Update()
method in the Game1 class with the following:protected override void Update(GameTime gameTime) { Camera.Position = new Vector2(hscroll.Value, vscroll.Value); MouseState ms = Mouse.GetState(); if ((ms.X > 0) && (ms.Y > 0) && (ms.X < Camera.ViewPortWidth) && (ms.Y < Camera.ViewPortHeight)) { Vector2 mouseLoc = Camera.ScreenToWorld( new Vector2(ms.X, ms.Y)); if (Camera.WorldRectangle.Contains( (int)mouseLoc.X, (int)mouseLoc.Y)) { if (ms.LeftButton == ButtonState.Pressed) { TileMap.SetTileAtCell( TileMap.GetCellByPixelX((int)mouseLoc.X), TileMap.GetCellByPixelY((int)mouseLoc.Y), DrawLayer, DrawTile); } if ((ms.RightButton == ButtonState.Pressed) && (lastMouseState.RightButton...