Hi all! I have a question regarding the reducing of the player’s life when the player collide with an enemy. There are a total of 3 scenes in my game and the player’s life is able to reduce by 1 each time when it collides with an enemy in the first and second scene. However, i wrote the same actions (reduce player life by 1) in the third scene and the player’s life was reduced by 2. May i know how to solve this issue? Thank you for helping!
At the beginning of the scene:
txt Do = "x " + GlobalVariableString(Lives) to the text of NumberLives
Player is in collision with enemy, trigger once:
Do -1 to global variable Lives
txt Do = "x " + GlobalVariableString(Lives) to the text of NumberLives
Above are the actions that i wrote in all the 3 scenes.
Hey Meddy. Would you be able to post screenshots of your code for the third scene? It sounds as though you’ve doubled up somewhere or something is conflicting. Allowing us to see the code would help determine what’s wrong.
and it just updates that text object with the global variable every frame. No need to put the action again each time there is an event that would reduce the number of lives.
As a side note: you might want to consider an external events file so that you don’t have to copy the same code into each scene. That way, once you get the code right it woks correctly in every scene.