HELP! POWER UPS !
Lu_merlin
Member Posts: 45
Hello Everyone!
I have been using gamesalad since 4 days now and I LOVE it!
But i have a problem: I created a 2d shooter game and it has a few power ups. I know I can spawn an actor with a timer and so on but i would like to spawn the power up every time the player hits a thousand points.(1000,2000,3000...)
I don't know how to do it!
Please Help!!!
-Lu_merlin
I have been using gamesalad since 4 days now and I LOVE it!
But i have a problem: I created a 2d shooter game and it has a few power ups. I know I can spawn an actor with a timer and so on but i would like to spawn the power up every time the player hits a thousand points.(1000,2000,3000...)
I don't know how to do it!
Please Help!!!
-Lu_merlin
Comments
if scores >= 1000 spaw power up 1
if scores >= 2000 spaw power up 2
..
..
www.marcosriffel.com
1. I have a spawner.
2.That would only work once for 1000 and then 2000?
And What if i want it to go to 70.000 ?
Do i Have to do it 70 times ? Is there no different way?
Thx for the quick responses!
Here's how:
In the spawner actor, create an integer attribute called something like "powerUpScore".
Then use a Constrain Attribute and a Rule, like this:
Constrain Attribute
self.powerUpScore To: game.score%1000
Rule
when all conditions are valid:
self.powerUpScore >= 1000
-----Spawn Actor: [your power up]
That will spawn a power up every 1000 points, regardless of the score.
www.marcosriffel.com
Thanks for your help !!!
I tried to do what you said but it didn't work out.
I just have 2 questions:
-Shouldn't the powerupscore be a real attribute instead of an integer attribute ?
the modulus isn't an integer most of the time is it ?
-And why idid you write >= 1000 in the rule?
Shouldn't it be 0? i.e., modulus Gamescore/1000 = 0 ?
I also tried to display the powerupscore with your syntax to debug the code but it stayed 0.
Any help would be much appreciated!
It should be:
Constrain Attribute
self.powerUpScore To: game.score%1000
Rule
when all conditions are valid:
self.powerUpScore = 0
-----Spawn Actor: [your power up]
Modulus just shows the remainder after division. I would leave it as an integer. Unless your score has decimal places?
i.e:
1007%1000 = 7
1005.6%1000 = 5.6
Or get some more sleep, either one!
When you create the powerUpScore attribute, initialize it to be 1 instead of 0.
Or put in a condition like rob2 says.