How do I Register "Damage" to Individual Tiles in a 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
  • I want to be able to damage tiles when they are hit but I want some tiles to be more durable than others. I know that tilemaps can have instance variables but they seem to apply to the whole tilemap and not just the tile being affected. I want the individual tile to remember that it is damaged. The only solution I can see is to create multiple tilemaps with different variables of "durability" and when it gets damaged I replace it with one of a lower durability. Is there some other solution possible or is having many different versions of a tilemap the only way of doing it? Thank you in advance for your response!

  • You can use an array to store each tile's state in, indexed by the tile indices.

  • Thank you. My question feels dumb now. Still wrapping my head around how to properly integrate arrays into what I want to do. I just tried storing the tile state in an array and subtracting its "health" when a bullet collides with it, however it only subtracts it once. So with a default value of 3, it subtracts to 2, but won't subtract further upon further bullet collisions. I don't know if I need some kinda for loop or something but I have included a snapshot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't use CurValue, you need to index it explicitly: Array.At(...,...)

  • Thank you for your help! I have it working now with this.

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