Creating a boost event per animation of the Boost Bar.

0 favourites
  • 8 posts
From the Asset Store
Per Pixel Destruction like in "Worms" (perfect performance, no third party plugins)
  • Hello!

    So I have been making a racing game and I have gotten nearly all of it down except for the boost function.

    I have a boost bar that is an animation and stays on the HUD. Now I have a keyboard input (and will later implement touch controls as well) and the boost is controlled by the pressing of the Spacebar.

    In the event sheet I have a global variable that matches the total animation frames (9) of the boost bar and when the space bar is pressed I want it to decrease the frame by one.

    For some reason I am not able to decrease the frame by 1 all I am able to do is start/stop the animation.

    I would like this because I also have an event: once the frame is changed on the boost bar animation the car speed in increased and the global variable Boost is decreased by one as well and once it is depleted it would refill the boost. Right now it is just refilling automatically as the animation is started and is stuck in a perpetual boosting of the car without even pressing throttle.

    TL;DR I am trying to control an animation to go down by one as a space bar is pressed.

    And Any hints on how to set the boost to reset every lap would help alot too (but that's extra)

  • Set up a function for boost something like when boost is triggered (space bar)

    Play animation frame(0)

    Wait 1 second

    Play animation frame(1)

    Wait 1 second

    Play animation frame(2)


  • First make the animation speed 0 (click the animation, and change it in the properties bar)

    Then you can use Set frame -> Object.AnimationFrame + 1 when the player presses the space bar

  • Hey guys!

    It worked and now I am able to control boost and set it to the keyboard input, (along with some other fixes to stupid things we wont tell anybody about )

    But now for some reason when I do this it doesn't seem to be actually boosting the car. I have the event as:

    Keyboard pressed -> car-> set speed to x ( I currently had it set as high as 5000 to see any changes)

    But it doesn't seem to actually increase the cars speed.

    Do I need to set the cars speed to increase for a set period of time for it to register? Because my current guess is that the speed only increased for one tick, and that is too small for the boost to actually affect the car.

  • You might need to change the car's max speed as well. There's no point setting the speed to 5000 if the max speed is only 350.

  • Ok, so I messed with increasing the cars max speed and that is not working too well either.

    And when I hit the keyboard that cars speed is set that high for the duration. and it wont slow down even if I try to hi the brakes. Should I make a global variable of boost and have that set to 1 when the keyboard is pressed and have that duration of car speed set higher?

    Or is there a simpler method of doing this that I am over looking?

  • lol thank you Ramones.

    I had realized that right after I submitted that post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey guys so I had to taken a break from this project.

    But I went back to it and realized I am still stuck at where I was.

    The break did not help with coming up with some other solutions, anyone else able to come up with something that may be able to make this work.

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