How to reset a layer and keep stats besides HP?

0 favourites
  • 3 posts
From the Asset Store
4K Hand Painting, 300 dpi and layer layer, psd and png files. 3200 x 4200
  • When all enemys die (I have 1 right now) or the player dies I have a button that resets the layer. It works good if the enemy dies but when the player dies his sprite doesn't reappear, his hp is still 0 and his xp is reset.

    Also, I want to keep the players xp so I made the player have a persist behavior but that also keeps his hp when i reset the room so I have to set the players hp back to 10. How can I keep the players xp but also reset the hp when I reset the layer?

  • Hey MrTholl

    The Persistent behavior is not a suitable behavior for the player. Delete this one and, in case, disable the 'Global' property. Create a global object like an array or a dictinary to store persistent player stats. You dont need to fill out the array/dictionaray directly. It is enough to give it some instance variables and work with them:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for taking your time to write code. I kept the player persistant but made an initial hp so that I can change hp back to initial hp when i restart the layer.

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