How Do I Gradually Increase Speed????

Get help using Construct 2

Post » Tue Mar 17, 2015 4:17 am

Okay so i have my player on the left hand side of the screen. The enemies are on the right hand side and are being spawned every random number of seconds. They have a current bullet speed of 400 heading towards the player.
To increase the difficulty of the game i want to increase their speed by 100 every 5 seconds. Now i tried doing this through the following:

Enemy.Bullet.Speed+100...............This increased the enemies speed by 100 after being spawned, however once a new enemy was spawned it was back to its original speed of 400 and then increasing by 100. So it was only ever 400+100.....400+100......400+100 and not 400+100.....500+100.......600+100........etc

Do i need to add an instant variable to the enemy? if so how do i associate the instant variable with the enemies bullet speed??

Thanks :D
B
8
S
2
Posts: 146
Reputation: 1,132

Post » Tue Mar 17, 2015 6:42 am

You will need the speed to be set inside the spawned enemy in a [On Created] event that way each new instance overwrites the default speed value with the new one.

You will need a global "Speed" variable.
Make an event that increments the Speed variable every 5 seconds with action Variable Add: -100 (If your going right to left you will need a negative speed value).
Set your Enemy bullet speed to 0 in inspector and set its speed after creation using On-Created event: "On-Created - Set bullet speed -400+Speed.

Now just spawn away. I made a small .cpax that shows my work. Maybe this will help get you headed in right direction.
You do not have the required permissions to view the files attached to this post.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Tue Mar 17, 2015 11:11 am

event
every 5 secs
pick all enemies
action
set enemies.bullet speed to enemies.bullet.speed + 100
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Tue Mar 17, 2015 11:53 am

There are many ways to do it but, here is simple demo to start you
You do not have the required permissions to view the files attached to this post.
B
249
S
39
G
15
Posts: 1,952
Reputation: 40,579

Post » Tue Mar 17, 2015 1:43 pm

Great I managed to get it to work using the global variable! thank you!
B
8
S
2
Posts: 146
Reputation: 1,132



Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], eochranek, Unconnected and 18 guests