Add 1 live when reach 1000 points

Get help using Construct 2

Post » Tue Jan 22, 2013 4:17 pm

I have 2 variables
player1_lives
player1_points
what I want is that whenever player1_points reach 1000 points adding 1 live to variable player1_lives

if I put:
system: player1_points> = 1000
trigger eleven | add 1 to player1_lives

life adds 1 life every time I load the level. :-(

as is the right way to do it??
B
45
S
9
G
10
Posts: 194
Reputation: 8,165

Post » Tue Jan 22, 2013 4:30 pm

So if they die and have over 1000 points, when the level starts it sees they have over 1000 points and gives them another life right?

Since your score can go over 1000 you may want to have another variable called player_1up and when you add points to there score also add those points to this variable. When it hits a thousand, give the player a new life, and reset the variable to 0 so that when they respawn or the layout restarts the number is not over 1000 and won't just keep giving them free lives. Don't test on the score variable or they will get a new life everytime the check is made once their score is over 1000. Unless they lose points or you reset the score, it will always be true once they reach 1000 points and at that point anything that triggers the check will give them another life.

For example if they have 1001 points, and then they get a fee man, then 10 seconds later they are up to 1101 points if the check gets triggered again they would get another free life since they are still over 1000 even though they haven't made another 1000 points. Does that make sense?

Unless you are already handling those scenarios. It is hard to tell without either an image of your event sheet or a capx.

Hope this helps...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,413

Post » Tue Jan 22, 2013 6:22 pm

Thanks

You gave me an idea
Global_player_next_live = 1000

System | player1_points >= player_next_live |

Add 1 to Player_lives
Add 1000 to player_next_live

Ready, Thanks
B
45
S
9
G
10
Posts: 194
Reputation: 8,165

Post » Tue Jan 22, 2013 6:28 pm

Awesome, glad to be of assistance! Just remember that if there is anythign in your game that can reset the players score, that you need to reset your player_next_live variable too.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,413


Return to How do I....?

Who is online

Users browsing this forum: Draconinho, LeFuji, plinkie, totoe, Yahoo [Bot] and 19 guests