Still stuck on trying to make speed boost work properly

Okay, so I had already asked a question about this same subject days ago, and I got a very helpful answer that helped me to solve the first part - making a working self-charging stamina bar!

This is working exactly as intended. :slightly_smiling_face: (credit to @Agent_Y for the help!)

Also, my basic movements are currently working exactly as intended.

Sorry, I know it’s a little clunky and could be simplified, but I’m afraid to mess with it for fear of breaking anything.

Now here is the part I’m still having trouble with. I created this:

Which is supposed to activate the speed boost only when the shift key is held down and there is enough available stamina. The speed boost is supposed to work in every direction, when both shift + a directional key are pressed simultaneously…

Um. Something like this.

Looks like it should be “simple enough” right? :laughing:

Problem is, when I try to connect one thing, it breaks another thing. My sprite ends up either moving indefinitely, or moving backward, or ignoring the speed boost, or not moving at all.

I really wanted to figure this out on my own, but I don’t want to spend the next week banging my head against the wall trying a million different combinations. So I’m breaking down and humbling myself and asking for help.

Basically what I want the sprite to do is…

When I am holding down left, I want it to move left at the default speed.
When I am holding down left + shift (speed boost), I want it to move left at fast speed, but only until the stamina bar is empty. Once the stamina runs out, it should return to default speed.
If I am not holding down left, I want the sprite to come to a complete stop.

Same with every other direction - up, down, and right.
I want the sprite to not move when no direction keys are pressed.
I want it to move at default speed when directional key is pressed without shift boost.
I want it to move faster in every direction when both a directional key + shift key are pressed at the same time until the stamina bar is depleted.

I hope that makes sense.

My question is, what do I need to add in between functions to make this work properly without breaking my currently functional movements? Switches, logic gates, filters, something else?

EDIT: oh and yeah, sorry for blurring out the background. I don’t want to give away the rest of the game until it’s finished. :slightly_smiling_face:

And I also realize the up/down numbers are backward… for some reason, on my PC at least, the negative Y function is moving me up and the positive Y moves me down… must be set to inverse as default.

1 Like

Are you using the set input when you apply the speed boost?

and yeah the Y stuff is backwards for some reason

1 Like

I don’t know why the Y is backwards for me. It works correctly if I put a switch in before the Y movement, but when I connect them directly, -Y moves me up and +Y moves me down.

For the speed boost, I’m using this:

speed boost

Logic gate a is connected to the shift key down, logic key b is connected to a filter that is supposed to check to make sure I have enough stamina to use the boost. If both conditions are met, it should activate “Boost on”.

If shift key is up OR I don’t have enough available stamina, it is supposed to activate the “Boost off”.

Does that part at least seem correct? Or do I need to add switches and an additional logic gate?

EDIT: the “greater than 9” in the filter is because I set 10 as the default minimum stamina for boost (100 is the max, and it depletes by 10 for each set amount of time the shift key is held down; it recharges slowly when the shift key is not held down)

Did it that way intentionally so that you could use the boost even when it’s not 100% full, though with only 50% stamina filled, you will only be able to use it for half as long.

This doesn’t show me how you’re actually making the character faster… show we what’s on the other side of the messages


I wanted to make sure I had the boosts working correctly first, to make sure that wasn’t breaking them.

I updated them to this:

Filter is connected to stamina to check that I have enough.
Shift key DOWN is connected to (a) on the first [AND] logic gate.
Pass is connected to (b) on the first [AND] logic gate.

With the assumption that “Boost on” will only be activated when shift is held down AND I have enough available stamina.

Shift key UP is connected to (b) on the second [OR] logic gate.
Fail is connected to the (a) on the second [OR] logic gate.

With the assumption that “Boost off” will be activated if either the shift key is up or there is not enough available stamina.

As for the actual speed boosts themselves… I’m not showing them because all of the setups I’ve tried so far have failed, so I know they’re wrong.

These are my default movement commands, and they are working correctly for me.

I want the “Boost on” to activate higher speeds in all directions, and “Boost off” to return speeds to default speed.


The problem is, every time I connect the “Boost on” links to flip and velocity, and the “Boost off” links to defaults, my sprite starts behaving erratically. It either freezes, or it moves backwards, or continues moving even when I’m not pressing any key.

1 Like

You could try to add switches that turn off the 6 velocity when the boost is on and turn them back on when the boost is off so that only the 10 velocity is hitting it. Also do you have them connected to 0 or no? it’s a dumb question but still asking.


The original movement keys are connected to zero input when they are not pressed, so that the sprite stops immediately when not moving. That is intentional.

RE: the switches - that’s a good idea, I’ll give it a try. Thank you! :slightly_smiling_face:

I added these to make sure the sprite STOPPED moving when the movement keys were not pressed. This function is currently working correctly on my end.

ADDITIONAL: In case anyone is wondering why I have both arrow keys and WASD setups, I did that for accessibility. Being right handed, I prefer arrow keys. But many people (both left and right handed) seem to prefer WASD. I want this game to be playable either way so that everyone can enjoy it.


The velocity isn’t ever changing though right? This seems over complicated


I know, the solution is probably much simpler than what I’ve been testing.

Basically I want it to move left when I press left, and stop when I’m not pressing left.
Move up when I’m pressing up, and stop when I’m not pressing up.
If I’m pressing both up and left at the same time, I want it to move diagonally.
Then stop (speed zero) when I’m not holding down either key.

If I’m pressing shift + left, I want it to move left at a higher speed until my stamina is depleted.
If I’m pressing shift + up, I want it to move up at a higher speed until my stamina is depleted.
If I’m pressing shift + left + up, I want it to move diagonally at a higher speed until my stamina is depleted.

Once my stamina is depleted, I want it to return to default speed.
But still stop (return to speed zero) when no movement keys are being pressed.


I’ve looked at other examples of speed boosts, but none of them worked the way I wanted them to. One example I saw activated a temporary speed boost after touching an object, but that speed boost was set to a timer and it was only in one direction. Another example had infinitely available speed boosts that were tied to different keys than the normal directional keys (essentially something like press D to move right at normal speed, press E to run right at fast speed).

I want my speed boost to work in 8 different directions, but to only be usable if the player has enough available stamina. Once the stamina runs out, the player returns to normal speed and must wait for stamina to recharge before boosting again.

1 Like

It’s a really petty thing to get hung up on, I should just abandon the speed boost idea entirely. But I wanted to incorporate it into part of the higher level gameplay, as a means of being able to quickly dart past dangerous obstacles in the higher levels. That way I can make the end game more challenging - I can make faster enemies and also give the player the ability to outrun them with proper timing.

And also add to my own skill set in case I want to incorporate a similar type feature later in another game.

Again, like I said, I thought about just abandoning the feature entirely. But I shared my initial starting level with a friend of mine (who isn’t a member here and doesn’t know how to make games himself)… he thought it was neat. When I told him I was hung up on trying to make a speed boost, and I was considering abandoning it altogether so I could just finish the game, he told me “No! A speed boost sounds really cool! You should figure out how to make it work.”

1 Like

Just set the number to a higher number while you’re sprinting and then set it back when the stamina depletes or when you let go of sprint


That’s what I’m trying to do. But I don’t know how to code, and the basic tutorials on here don’t teach that. Every time I add a different number output, my sprite seems to get stuck on one, or the other, or both. Really all I need to know is what combination of switches, filters, logic gates I need to incorporate, and in what order, to make all of that work properly.

I’ll make a nice clean example and I’ll post it here when I’m done

1 Like

Like if I have a default speed 5 and a sprinting speed of 10. How do I make it sprint when I’m pressing sprint and have stamina, and go back to normal speed when I’m not pressing sprint and/or run out of stamina? And make it work in every direction? And also have the character stop moving entirely when no movement keys are pressed?

Thank you so much! I’m sorry for being such a noob. I just want to make games that are fun to play. As I’ve mentioned here before, I have ideas, I just lack the skills. Any bit of help I can get from experienced game developers is very much appreciated. :slightly_smiling_face:


Sorry for bumping this thread again, but nothing I’ve tried is working. The basic movements are working. The stamina bar is working. The speed boost itself, however, is not working.

I’m sure I just need to add more switches or something… but I’ve tried at least a dozen different combinations of switches and logic gates and still nope. Sprite either stays at default speed or gets stuck on permaspeed or permastop.

Visual key:


Never mind! I finally solved it for myself! :grin: :partying_face: :heart_eyes:

This was the solution:

Thank you everyone for the help!!!