How Do I Gradually Increase Speed????

0 favourites
  • 6 posts
From the Asset Store
Animated Counter
$3.60 USD
10% off
Make a displayed number gradually increase or decrease, making an impression of a real-time counting.
  • 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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • event

    every 5 secs

    pick all enemies

    action

    set enemies.bullet speed to enemies.bullet.speed + 100

  • There are many ways to do it but, here is simple demo to start you

  • Great I managed to get it to work using the global variable! thank you!

  • good for you zikdot

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