How do I change tilemap tile, based on collision

0 favourites
  • 5 posts
From the Asset Store
Advanced inventory mechanics for your RPG game (Array-based). Take Items, split them, pick up them, read the description
  • I've never worked with tilemaps before (shame on me) and I have a collisionbox (an object) that moves over the screen. I want it to change the tile from 0 to 1 when it has collision, but all I can find is "compare tile at". within the tilemap. Any suggestions?

  • Anyone?

  • Try:

    Sprite| Is overlapping Tilemap -> Tilemap|Set tile (Tilemap.PositionToTileX(Sprite.X),Tilemap.PositionToTileY(Sprite.Y) to tile 1

    sprite is your collisionbox, tile 1 is the number of the tile you want in exchange.

  • Asmodean, this sort-of works, except that it only changes the tile that's in collision with the image point and not the object. Other than that it works good.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could try with setting a range of tiles. If you pick the upper left corner of your object with x=Sprite.X-Sprite.Width/2, y= Sprite.Y-Sprite.Height/2 (Origin had to be set in the middle of the sprite) and the multiple of the tiles to the sprite: width = sprite.width/tileWidth height = sprite.height/tileHight:

    Sprite| Is overlapping Tilemap -> Tilemap|Set tiles at (Tilemap.PositionToTileX(Sprite.X-Sprite.Width/2)),Tilemap.PositionToTileY(Sprite.Y-Sprite.Height/2)) with area ceil (Sprite.width/32) x ceil(Sprite.Height/32) to tile 1

    The tile width and height is in this example 32.

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