How do I rotate tile randomly?

0 favourites
  • 3 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • 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.

    Try Now 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

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