Creating a boost event per animation of the Boost Bar.

Get help using Construct 2

Post » Sun Mar 09, 2014 9:23 pm

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. :x

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)
B
3
Posts: 7
Reputation: 214

Post » Mon Mar 10, 2014 1:06 am

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)
etc.
B
46
S
16
G
76
Posts: 2,150
Reputation: 45,313

Post » Mon Mar 10, 2014 2:28 am

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
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sun Mar 16, 2014 3:09 pm

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 :roll: )

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.
B
3
Posts: 7
Reputation: 214

Post » Sun Mar 16, 2014 3:16 pm

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.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Sun Mar 16, 2014 3:49 pm

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?
B
3
Posts: 7
Reputation: 214

Post » Sun Mar 16, 2014 3:51 pm

lol thank you Ramones.

I had realized that right after I submitted that post.
B
3
Posts: 7
Reputation: 214

Post » Sun May 04, 2014 9:17 pm

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.
B
3
Posts: 7
Reputation: 214


Return to How do I....?

Who is online

Users browsing this forum: ASHKAR, brunopalermo, ItsAstro and 22 guests