A
Ann
Guest
Inside of obj.player, step event:
if global.current_score>49
{
global.hearts+=1;
global.current_score=0
}
EXPLANATION
This says that if my current score (coins) happens to be more than 49, then add 1 more life. The score will be reset to 0. And you will have to pick up 50 coins again to add another heart.
THIS IS THE PROBLEM:
If I don't reset the score to zero the code will add 1 heart every frame. That just looks weird and its not gonna work. I only want to add 1 heart ONCE without resetting the score to 0. What piece of code can I add here to make it add to the global.hearts once, and not once every frame.
Hope this explains enough. Do ask if you have any questions Btw, all of the variables are placed in a seperate obj. I placed them in an obj called obj_control
if global.current_score>49
{
global.hearts+=1;
global.current_score=0
}
EXPLANATION
This says that if my current score (coins) happens to be more than 49, then add 1 more life. The score will be reset to 0. And you will have to pick up 50 coins again to add another heart.
THIS IS THE PROBLEM:
If I don't reset the score to zero the code will add 1 heart every frame. That just looks weird and its not gonna work. I only want to add 1 heart ONCE without resetting the score to 0. What piece of code can I add here to make it add to the global.hearts once, and not once every frame.
Hope this explains enough. Do ask if you have any questions Btw, all of the variables are placed in a seperate obj. I placed them in an obj called obj_control
Last edited by a moderator: