How do I increase object / enemy speed

0 favourites
  • 3 posts
From the Asset Store
Several elements of the game interface hidden objects
  • 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.

  • Do you have any capx to mess with ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)