How do I add hitpoints to a specific tile?

0 favourites
  • 2 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • Hi,

    How do I add hitpoints (or any variable for that matter) to a specific tile in my game?

    Currently, I have tiles of mushrooms, trees, ore, etc..., and I have a mechanic where the player destroys it in one hit if the distance and tool in hand requirements are met. However, I want to deepen then experience by adding hitpoints to the specific tile being "attacked".

    I know how to do this easily with sprite instances but having a bunch of sprites kind of defeats the purpose of the tilemap and it also slows my game down a lot. (tested it previously)

    Any ideas on how to do this or is there another way? I need a hitpoint variable associated with each tile so that the attack can be done and "chip" or "chop" away at the tile, reducing its hitpoints until zero. Right now it's one hit, one achievement and then I automatically switch the specific tile to grass or whatever the natural environment is.

    For example, if the tile being attacked is 34 and 34 has been coded to be a "tree", then the maximum hitpoints are 10 but I also need to know which tile it is specifically not just in the tilemap object itself but in the instance . If the tile being attacked is 73 and has been coded to be a "copper ore", then the maximum hitpoints are 6, etc...

    One thing I thought of and it is not ideal is to just identify which tile index id the tile being attacked is and then make the player roll a dice roll higher than a specific requirement, with the aid of the tool and player strength as +N for the dice roll, however, that would really change my vision of how to achieve things in the game.

    Thanks for any help. I think I am really close to being able to run with my vision. Everyone has been great these last few weeks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the player is going to destroy or alter the tile you can file specifices in a dictionary with key 22d44 say for tile at 22,44 once the ore is destroyed erase the entry from the dictionary. If the player does lots of tiles halfway you might not want to use a dictionary, but if it is sparse matrix, so to speak, it will work fine.

    If you need to know all kinds of things about the tile location store it as a string (even a json string).

    yours

    winkr7

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