Extra life a certain amount of points
#1
Posted 16 May 2012 - 12:47 AM
Please help!
#2
Posted 19 May 2012 - 06:41 AM
Every 10'000 points:Just started another project, and I want the player to a get an extra life when the player gets 10,000 points. But when I tried, the player just gets infinite lives.
Please help!
//Create
bonus = 1;
points = 0;
//Step
if (points >= bonus*10000) {
bonus += 1;
lives += 1;
}After first 10'000 points:
//Create
bonus = false;
points = 0;
//Step
if (points >= 10000 && !bonus) {
bonus = true;
lives += 1;
}
#3
Posted 19 May 2012 - 07:02 AM
The set up would be something like this
Create:
score = 0; bonusPoints = 0;
Create a script and name it something appropriate, for example increase_score
Script increase_score:
score += argument0;
bonusPoints += argument0;
if (bonusPoints >= 10000) {
bonusPoints -= 10000;
lives += 1
}The reason i subtract 10000 from bonusPoints instead of setting to 0 again is for any overflow. For example if you're at 9999 and you gain 1000 points (10999), resetting to 0 would lose 999 points causing issues between the score and when the player expects to get the next life.
Now just use that script every time you want to award points to the player, where argument0 is the amount you want to award.
increase_score(100);
#4
Posted 19 May 2012 - 08:19 AM
Step event:
if ((score div 10000) != (lastscore div 10000))
{
lives+=1;
}
lastscore=score;
#5
Posted 22 May 2012 - 08:44 PM
It won't work. I installed everything correctly!Every 10'000 points:
Just started another project, and I want the player to a get an extra life when the player gets 10,000 points. But when I tried, the player just gets infinite lives.
Please help!//Create bonus = 1; points = 0; //Step if (points >= bonus*10000) { bonus += 1; lives += 1; }
After first 10'000 points://Create bonus = false; points = 0; //Step if (points >= 10000 && !bonus) { bonus = true; lives += 1; }
#6
Posted 22 May 2012 - 09:18 PM
#7
Posted 01 July 2012 - 08:09 PM
That one's broken too.Did you try my one?
#8
Posted 01 July 2012 - 08:39 PM
One possible error you might be experiencing is an 'unknown variable lastscore'. If so, simply put
lastscore=scorein the create event. This is called 'initializing' the variable.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











