Rotate a tile in TileMap

Attached Files

The following files have been attached to this tutorial:

.capx

plumbermechanic.capx

Download now 188 KB

Stats

756 visits, 1,085 views

Translations

This tutorial hasn't been translated.

Tools

I found a way to rotate a tile in tilemap when starting a Plumber game and I want to share with you :)

Step 1

Insert a TileMap object in your project. You can use the default TileMap from Construct 2 or import your tilemap.

We also need to add TOUCH function in project to make it work.

Step 2

We'll start the core right now.

Create a Global variable tileState .

This will be a switch while you rotate your tiles.

We'll add the condition when touching the TileMap :

(1) Compare the Tile at TouchX and TouchY if the state of tile is NORMAL.

(2) The condition tileState = 0 for you can touchable after rotate.

Then the action will be :

(1) We set the tile at TouchX and TouchY to Rotate 90 degrees.

(2) Switch tileState to 1 to break the loop of touching.

Repeat it for remaining state of tile :

Add an event to switch tileState to 0:

That's all. You can run and check the result !

If there is any question, please leave your comment here :)

UPDATE ON JAN 17

I have added a condition for untouchable tile here :

All tile index > 11 are untouchable.

You can check my capx for more details.

.CAPX

plumbermechanic.capx

Download now 188 KB
  • 0 Comments

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