Erase tile by tile number and create object in it's place

0 favourites
  • 5 posts
From the Asset Store
It's here!
$2.48 USD
50% off
Creepy and nasty horror track. It's terrifying from the beginning till the end. Goosebumps guaranteed
  • I'm making an arcade style game where at the beginning of each level ajax loads a randomly selected tilemap.

    The tilemap has nine different images.

    I want to find a way to delete each tile that uses the ninth tile from the tilemap image and destroys that tile, then creates an object at the place the tile was destroyed.

    When I go into the tilemap editor to edit the image of a tile I see that the ninth tile is labeled as "Tile 8" (Probably because of the 0 index values) but I have no idea how to access this info via an event.

    Ideally it would be good to have a condition that picks all tiles using "Tile 8" and replaces them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are your layouts the same size? If they are, I probably have a solution of how to do it, otherwise it might get slightly more complicated.

  • Are your layouts the same size? If they are, I probably have a solution of how to do it, otherwise it might get slightly more complicated.

    Yes! In fact the goal of the game is to all take place on the same layout with only the tilemap and objects switching out mid gameplay.

  • You should make two global variables. One for the tile's X and one for the tile's Y.

    Set variableX to: TileMapName.PositionToTileX()

    Set VariableY to: TileMapName.PositionToTileY()

    Set the layout position into the (), i.e as an example number for PositionToTileX(24). Then, using the Erase Tile action under your tilemap, set the X/Y when it asks for them to your global variables and you can then also use your two global variables to spawn in an object at the same location right after, as long as you don't overwrite or erase what is in your two global variables.

  • You should make two global variables. One for the tile's X and one for the tile's Y.

    Set variableX to: TileMapName.PositionToTileX()

    Set VariableY to: TileMapName.PositionToTileY()

    Set the layout position into the (), i.e as an example number for PositionToTileX(24). Then, using the Erase Tile action under your tilemap, set the X/Y when it asks for them to your global variables and you can then also use your two global variables to spawn in an object at the same location right after, as long as you don't overwrite or erase what is in your two global variables.

    Thanks you so much! Looks like I got it working.

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