Introduce powerups at certain intervals in game

Get help using Construct 2

Post » Fri Mar 01, 2013 10:34 pm

Hi all,more help required if possible please.
I am doing a basic shooting game and I have introduced a power up when the players score has reached a certain score for example when the player score has reached 100 a powerup will move onto the screen at a random position along the x axis and drop off the bottom of the screen. How can I achieve this again when the players score reaches another value , say 500 or something like that , and keep creating it as the score increases at different intervals.
Thanks in advance.
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Fri Mar 01, 2013 10:51 pm

You could use two separate variables. One for the score itself, and one that increases equally with the score and works as a counter.
Actually follow the counter for the sake of the power up, and when the power up is spawned reset the counter variable to 0.
B
6
S
1
Posts: 67
Reputation: 986

Post » Fri Mar 01, 2013 11:41 pm

Do you want it to be a linear (i.e. every 100 points), exponential (i.e 100, 200, 400, 800 points, etc...) increase between power ups or do you want to use a list of values that you personally are picking arbitrary?

The Mod operator is your friend here...That's the '%' symbol.

Linear:
System -> Compare Variable Score > 0
System -> Compare Variable Score % 100 = 0
-- System -> Trigger Once While True
-- (Spawn your power up)

Exponential is a little more tricky:
Global Variable -> PowerUp = 1

System -> Compare Value Score > 0
System -> Compare Value Score %(PowerUp*100) = 0
-- System -> Trigger Once While True
-- System Add to PowerUp 1
-- (Spawn your power up)

And picking from a list is even more tricky if you aren't use to arrays.. You'll need an array object (we'll call it PowerUpArray):
System -> On Layout Start
--PowerUpArray Push Back 100 on X axis
--PowerUpArray Push Back 300 on X axis
--PowerUpArray Push Back 900 on X axis
--(Repeat until all are in the array

PowerUpArray -> Contains Score
-- System -> Trigger Once While True
-- (Spawn your power up)
theubie2013-03-01 23:42:45
B
26
S
8
G
3
Posts: 210
Reputation: 5,973


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas and 0 guests