# How do I rotate tile randomly?

0 favourites
• 3 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
• Tile rotation is set with a string/boolean message. But I would like to do this mathematically, (int(random(0,4))*90 degrees.

Right now only way I can manage is to create a local variable/parameter and make a condition for each parameter value, which is cumbersome waste of space.

Suggestions?

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Right now only way I can manage is to create a local variable/parameter and make a condition for each parameter value, which is cumbersome waste of space.

What do you mean?

• I'm not sure I understand 100%, but i'm thinking that doing this with a function will do something?

* On function 'SetStateBasedOnNumber'

* Parameter 'number' (Number)

* Parameter 'x' (Number)

* Parameter 'y' (Number)

----+ System: number = 0

-----> Tilemap: Set tile (x, y) state normal

----+ System: Else

----+ System: number = 1

-----> Tilemap: Set tile (x, y) state rotated 90°

----+ System: Else

----+ System: number = 2

-----> Tilemap: Set tile (x, y) state rotated 180°

----+ System: Else

----+ System: number = 3

-----> Tilemap: Set tile (x, y) state rotated 270°

+ System: On start of layout

-> Functions: Call SetStateBasedOnNumber (number: floor(​random(​4​)​), x: 1, y: 1)

You can just make a loop through x and y?

Hope this helps

• 3 posts
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)