How do i Randomize tiles in tilemap

0 favourites
  • 5 posts
From the Asset Store
Piano tiles
$9.99 USD
Template for a piano tiles game, fully documented in comments and video
  • Heres what im trying to do: i have a tilemap with 3 tiles (0,1,2), i would like to spawn these on the start of the layout in a 10x10 grid but i want each tile in the grid to be randomized between the 3 tiles.

    I tried this which didn't work:

    + System: On start of layout

    -> Tilemap: Set tiles at (0, 0) with area 10 x 10 to tile floor(random(3)) (normal)

    this just spawns the 3rd tile all over the grid, any suggestions on how to do this?

  • If I correctly understood, something like this will do the job.

  • Yay! it worked, thank you :D

  • What about if i need to change a tile when you click it, into a different tile? how do i pick that specific tile which i clicked?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I managed to get it to work by doing this:

    | Global number MouseY‎ = 0

    | Global number MouseX‎ = 0

    | Global number TileY‎ = 0

    | Global number TileX‎ = 0

    + System: Every tick

    -> System: Set MouseX to Mouse.X

    -> System: Set MouseY to Mouse.Y

    -> System: Set TileX to Tilemap.PositionToTileX(MouseX)

    -> System: Set TileY to Tilemap.PositionToTileX(MouseY)

    -> Text: Set text to "TileX" & TileX & " TileY" & TileY

    + Mouse: On Left button Clicked on Tilemap

    -> Tilemap: Set tile (TileX, TileY) to tile 2 (normal)

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