Make the player losing lives

0 favourites
  • 7 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi, I have problems when I made my character lose lives when lose. At the moment when the player dies, I made the system resets all global variables (the game becomes very buggy if is not set) and subtracts 1 to the var "lives", but when system reset the Layout, lives keeps the same. I don't know how can fix it :(

  • can you please post a capx. this could be the result of numerous small things. some obvious some maybe not so much. so it would help to see what is happening.

  • Jayderyu is likely a better expert to consult, but based on your initial message I'd double-check what's happening with the variables.

    You said the game resets the variables, correct? Wouldn't that reset the 'lives' variable, as well? So the number would never change because it's being put back to the original number every time. It might be extremely difficult to manage a 'lives' number if you have to reset variables all the time.

    You could use the WebStorage function to load/save the number of lives before doing the reset.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't know why it doesn't work, using WebStorage makes the game start with 0 lives, even less numbers.

  • Well ok. Here are a few things I found out towards working on your solution.

    restart layout was resetting everything based around session storage. However, it did not reset Webstorage Local(ie long term). You might be able to get away with other methods by using another layout that has some vars or something, but I wanted to minimize any tampering to your own work.

    dl.dropbox.com/u/14087254/HNK_game.capx

    For now it uses local storage. Just remember when players do a fresh start to manually set the lives at the main menu before starting the game play.

    Hope you find it of some use.

    Thanks for the vote of confidence Space Ape, but I'm a noob at C2 :D. I just find the more I try to help the more I get my hands into quirks of C2 and become better at it over all :D

  • Jayderyu, maybe your adventurous spirit and battle experience shows through, then! :)

    I'm finding the same thing by perusing the forums, reading about problems and how-to stuff; I keep asking "how would I do that?" and end up trying to work it out even if someone else is already helping.

    In this case, I was thinking WebStorage local values would be an easier fix than trying to work around the reset thing.

    Nicely done, sir.

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