How do I increase object / enemy speed

Get help using Construct 2

Post » Mon Jan 16, 2017 6:47 pm

How do I increase the speed of the object / enemies if the player reaches a certain score, or if the player reaches a certain time. But only for a certain duration.

Let's say, every 5 seconds on start of layout, an object will spawn with a bullet speed of 500. Then if player reaches 20 pts, the object will spawn every 3 seconds with a bullet speed of 600. This will last only for let's say 6 seconds, then it will go back to the default speed.
Posts: 20
Reputation: 840

Post » Mon Jan 16, 2017 7:11 pm

Do you have any capx to mess with ? :)
Posts: 32
Reputation: 3,007

Post » Tue Jan 17, 2017 1:49 am

Ok I am making an assumption that you mean EVERY TIME the player reaches 20 points this happens... ie 20 (bang), 40 (bang), etc

Use variables.
Make a global variable for the player's level (which by your description I believe you track already).
Make an instance variable inside player called triggered20 (or whatever) and set it to 0 on player creation (or true/false, your choice).
Make a TempScore global var (or instance var)
Have an event in player code that adds +1 to a TempScore var each time the PlayerScore (one used for display) is incremented. When TempScore =20 sets triggered20 to 1 and set TempScore=0 followed by a wait 6 seconds then set triggered20=0.
Copy your spawn event and make a second one, In the original one for "normal" put condition triggered=0 in its conditions. In the second put triggered=1 in conditions. (Yes you could do this with nesting and sub-events.. but keeping this as simple as possible).

Now the normal spawner will fire off enemies every 5 seconds at 500 until the player reaches 20 score (each 20) and then the triggered spawner will fire off enemies every 3 seconds at 600. This will happen until the 6 second wait is over and triggered20=0 again then normal spawner will begin again until 20 more score is gained in tempvar then it will repeat. An added bonus, at anytime you could set triggered20 to anything besides 0 & 1 and both spawners will stop spawning.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
Posts: 648
Reputation: 10,226

Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], OddConfection and 75 guests