Deaths per level - Saving value in table - first death is always adding 2, deaths after that add 1??
Okay, so I have the number of deaths being displayed at the top of the level scene...
It goes up when game.PlayerDead = true. This works wonders.
But now I'm attempting to add a grand total amount of deaths PER LEVEL that displays on a popup window that displays the level's highest score, the number of times a player has died attempting to play this level, and a "Start" button to begin the level...
For some reason, I just can't get the "number of deaths" to add correctly in the table.
When the player plays the level for the first time (even if there are recorded deaths already saved), the "number of total deaths attempting to play this level" increases by TWO the first time you die, but then increases by ONE each death after that, until you leave the scene, and open the level up again (which then, it increases it by TWO again for the first death, then by ONE each time thereafter)...
I'm mind boggled by this. Can someone explain what I may have done incorrectly for it to decide to add TWO deaths to the total number of deaths within the table on the first death, but then only adds one death to the total number of deaths each time the player dies after the first time?
What I've got for the Total amount of deaths for the level is when game.PlayerDead = TRUE, change table value blah blah to CURRENT VALUE +1. (So where is it getting +2 on the first death?! Ouufffffffff.) Haha...
It doesn't even make sense, and I've already spent an hour trying to figure out this ridiculousness. -_- I hate wasting time on stuff like this. Thanks in advance for any help I receive.
Comments
Okay, just realized something else that may help in seeing what I did wrong...
If you die, THEN leave the scene(level 1), and go back to the level, your score will stay as it was when you left. (Lets just say 24 deaths for sh_ts and giggles)
BUT if you DON'T die, and leave the scene(level 1), when you go back to the level, your # of deaths JUMPS UP +1 (So now it is at 25 even though you haven't died that extra one time, and it should still be at 24!)
Some crazy stuff going on here I tell ya.
Awe man... It seemed so simple, too.
Well 45 minutes later, I figured it out... >.< Man, I hate that! Haha, but it's all part of being a developer I suppose!! Loving it otherwise.
Glad you got it figured out! Trouble shooting is the best!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page