NateB's Recent Forum Activity

  • All in one event

    Global (or instance) variable speedPowerTimer = 0

    Every Tick

    Set speedPowerTimer to clamp(speedPowerTimer - (60*dt), 0 , 99)

    Set Speed to speedPowerTimer > 0 ? 400 : 200

    When you get the power-up, you can set speedPowerTimer to X seconds

    PS: The expression "speedPowerTimer > 0 ? 400 : 200" is a conditional expression.

    Fantastic 7Soul! Go with this

  • Global variable speedPowerTimer = -1
    
    System->on every 1 second
           Compare variable speedPowerTimer > 0: set variable speedPowerTimer = speedPowerTimer - 1
           Compare variable speedPowerTimer = 0: set Max Speed to 300 : set variable speedPowerTimer = speedPowerTimer - 1
    
    [/code:yw4cq77q]
    
    Then add one of the following to the collision event
    
    This one will make it so the duration is always 3 seconds whether or not you get 2 power-ups in a row
    Set variable speedPowerTimer = 3
    
    This one will make it so that the power-ups stack
    Set variable speedPowerTimer = speedPowerTimer + 4
    
    The reason +4 is used is to move it up to 3 from -1.
    The reason -1 was used was to ensure that the  speed wasn't unnecessarily reset every second.
    
    One side effect is that when stacking 2 in a row, instead of going for 6 seconds, the speed is increased for 7 seconds.  
    The workarounds are either a minor performance hit by removing the subtraction from the check to see if speedPowerTimer is equal to zero and setting the value initially to 0, or to add sub events on the collision to check the value of speedPowerTimer, and setting it to 3 if it is -1, else set it to speedPowerTimer + 3.
    
    Another optimization in the future to look at would be using an instance variable on your player so that you could have multiple players or ai using powerups.
    
    Anyway, I hope I didn't ramble on for too long.  I tried looking for a tutorial to help out, but they were primarily concerened with on screen timers.  Good luck with your game.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You'll want to bump up the Max Speed instead of the Acceleration.

  • I followed the clues, used the waybackmachine to find the subsequent clue(s) as they are no longer on the site, and found the princess without being awarded the badge. Just wanted to give a heads up on this.

NateB's avatar

NateB

Member since 6 Feb, 2014

None one is following NateB yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies