[Solved] Gets stuck on idle animation


#1

This sounds very similar to the last post I made but it Is Not The Same
Okay so what happens is when i press the trigger keys in rapid succession to turn the player in the other direction, it gets stuck on the first idle animation. I’ve attempted to fix this by moving around events, but it doesn’t seem to work.
It moves in the direction its meant too just fine, but the animation just faces forward and glides instead of switching to the walking animation.
I think it has something to do with the trigger once’s I’ve put in, but without those another part of the sprite doesn’t work.
Anyone have a way around this?


#2

As a thought - in the conditions with the trigger once, add a check that the current animation number is not what you are about to set it to.

So, for the very first one, the single trigger once, add the condition that current animation != 1.


#3

Sorry for not replying sooner, as I fell asleep, but how would one do this?
Is it okay if I ask for something more visual (If thats possible)?


#4

This snippet checks the animation is not already what you want to set it to:


#5

Like this?


#6

That looks very similar. Did it work?


#7

unfortunately, no it hasn’t worked


#8

I think you should refactor your script. As it stands, if you press the “a” or "d "key, then hold left shift, then let go of the “a” or “d” key and finally release the left shift, the maximum speed will still be 400, and not the 200 you want.

Here’s my take on what you’re trying to achieve. It works for me (and it will work as long as left right animations are 1 & 2, and run left and right are 3 & 4) :


#9

this would never work as expected. the trigger once needs to be under the condition, so the “change animation” is whats triggered once.

Edit: nevermind, wrote this before the morning coffee, should be fine as a subevent.


#10

I’m really sorry but that has just left me confused, sorry again


#11

If you press the “a” key, then hold down left shift, maximum speed gets set to 400.

If you then release the “a” key, there are no conditions that will reset maximum speed to 200 when you then release the left shift. That release left shift key is only actioned if the “a” key is held down.

My screen snip shows events that will get you what you’re after.


#12

I managed to figure out how to do this! : D


#13

That won’t work (sorry to burst your bubble). Why would you release the a key, while the d key and possibly left shift all at once? That’s what your events are doing - if the ‘a’ key is released then check if the ‘d’ key is pressed then check if the left shift is pressed. It doesn’t make sense.

Also, you don’t need the OR condition if there’s only one condition.


#14

it works though, otherwise i would be still stuck on this issue : P


#15

So you hold down the left shift key and the ‘D’ key while releasing the ‘A’ key to get animation 4? Because it won’t work otherwise. The combination of events dictate it.

You will need events elsewhere to get it to work.


#16

but it does work? it may not look like it but it does


#17

No, that piece of code does not. Something else does.

Here is a set of events identical to yours, that I rustled up. It changes the background to red. It only works if I hold down the left shift key and the d key and release the a key all at once. Nothing else makes it work :

image

Please, if you want to get anywhere with programming, look at the logic of your code, realise it can’t work, and figure out where it is working.

I am not going to comment any further.


#18

if it didn’t work for me i would be looking for a solution for it, but since it does work for me i guess this thread is closed ¯_(ツ)_/¯