Get a temporary movement speed bonus and have it accumulate? and make it able to pause/resume?

0 favourites
  • 3 posts
From the Asset Store
This is a source code sale for the game "Mega Bonus 777 Casino Game Html5"
  • Hello everyone,

    This is my first question here. I'm currently developing a top-down shooter game and I'm working on implementing an ability that grants the character a temporary movement speed boost after an enemy is killed for a few seconds. This effect should stack cumulatively, meaning each time the player kills an enemy, they receive a speed bonus that lasts for 2 seconds. However, if the player kills 10 enemies simultaneously, the speed bonus should still only last for 2 seconds (the designated duration of the skill), but the speed bonus should be 10 stronger.

    I've been able to implement the basic functionality successfully. The challenge I'm facing now is how to pause and resume this speed bonus effect. Currently, I'm using a system - wait action that adds the speed bonus, waits for two seconds, and then removes it. However, this approach doesn't allow me to pause or resume the speed bonus once it's activated.

    I've attempted to use a timer behavior instead, but I couldn't achieve the desired results because I need the speed bonuses to accumulate correctly.

    I would greatly appreciate any help or advice you can provide. If needed, I can provide more details about the implementation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Don't use wait.

    Timer is the correct way. On speed boost collected - check if timer is running. If not, start timer, add boost. Else add boost steength.

  • I want each speed boost to have its own independent duration, for example if I kill an enemy halfway through a timer, what you are proposing would simply reset the current timer and make it have more speed and not add another individual boost that lasts 2 seconds.

    Maybe I haven't explained in the best way how the boost works, let me try to explain it more deeply.

    If I kill an enemy a two second boost is added, if one second passes and I kill a second enemy another boost is added so that remaining second left from the first enemy should have the speed bonus of the two enemies I killed , but at the end of the remaining second I would have to remove the boost from the first enemy and I would only have the remaining second from the last enemy I killed.

    I hope you understand me.

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