How to make Mouse Erase Tile from a Tilemap in Game.

  • 5 favourites


2,373 visits, 3,548 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Alright so you want to have the player remove a tile or change a tile to another one.

To Remove Tiles

On LMB Clicked >> Tilemap >> Erase Tile >>

X | Tilemap.PositionToTileX(Mouse.X)

Y | Tilemap.PositionToTileY(Mouse.Y)

To Change Tiles

On LMB Clicked >> Tilemap >> set tile >>

X | Tilemap.PositionToTileX(Mouse.X)

Y | Tilemap.PositionToTileY(Mouse.Y)

Value |3

Tilemap. <- Is the name of the tilemap

.PositionToTileY(Mouse.Y) <- is the command part of the code.

NOTE: Inventoryitems in the picture is what I renamed the tilemap to, for you it should be tilemap. Sorry for the confusion.

Experiment with this till it works how you would like. I wish you the best of luck in creating your game. There was no other place I could find this information so your welcome LOL

Now go create good games.

Tips: paypal: Thank you!


  • Order by
Want to leave a comment? Login or Register an account!