I’m trying to make a crouch and a crouch walk. The player (Maxwell) when crouching, it switches to the crouch sprite and then to the idle sprite very fast. How do I fix this?
Here is all the code relating to crouching (crawling):
I’m trying to make a crouch and a crouch walk. The player (Maxwell) when crouching, it switches to the crouch sprite and then to the idle sprite very fast. How do I fix this?
Here is all the code relating to crouching (crawling):
You using variable numbers as switches and no timers here.So what you expecting?You even not touch to frames but only animation names you setting here.
You need use higher numbers and assign your animation frames equally showing as the variable numbers are counting.
Like:set to “object66” frames to “variable66”.
So if your variable66 equal to 0 your object’s first frame showed up,if variable66 equal to 5 your object sprite 6th frame are showed up.
You know there is waiting action you can add to your actions what can delay the upcoming other action.
Or you can use object timers for that delay.so the variable counting become slower not happening immediatelly as you experience now.
@bandi6891, I’m not sure what you’re on about, but I think you’re barking up the wrong tree, so to speak.
@MrDumbGuy, can you include screen shots of the events that set the animation to idle? And also where you set Maxwell’s variable crouching (which, btw, might be better off being a boolean)?
I put it in Maxwell, and the events that set the animation to idle is the If maxwell is on floor and the inverted Maxwell is moving
A screen shot would be preferred. So how are the conditions different to those that set the animation to “crouchwait”?
Can you screen shot all the events that set Maxwell’s animation to idle? Not describe them, but screen shot them? And screen shot all the events that change the value of Maxwell’s crouching variable too?
yea ok sorry heres all the things that set it to idle (including the one that sets it to the crouch):
That’s part of your earlier screen snip.
The whole picture, of what is being actioned and when, is needed in order to figure out what is going on.
So, regarding the screen shot from a few replies back, are they all the Maxwell animation changes? Or are there more?
And what about the actions that change Maxwell’s Crouching variable? Can you screen shot them?
Because although the issue is with the setting the animation, the cause of that may be elsewhere in other events. That’s why I’m requesting more screen shots.
Is it ok if I screenshot the entire thing?
like the entire code?
Yes, that’ll be fine.
Sweet. Now to when the rapid animation change happens.
Does it flicker from one to the other, or does it occur once where the animation changes and then that’s it?
When does it occur - can you describe what you do and what happens? For example, do you only press down, do you press down and move left/right or some other combination?
The sprites flicker from one to another, and it’s only for when I am only pressing down. When I crouch walk, it fixes the issue, but when you stop crouching and crouch again, it starts flickering again.
The issue is you have 2 conflicting events:
and
Both can have conditions that are true at the same time.
To fix this, remove the change animation in the '"Down" key is pressed
’ event - the animation changes are handled by the later events.
Also check that the distance from the sprite origin to the bottom of the hitbox is the same for all your animations. It they’re not, then when the down key is pressed the sprite is changed, and if it’s not flush with the platform as the previous sprite was, then it’ll drop and change animation to falling before changing to the crouch animation when it lands on the platform.
Ok thx, i will try that
Btw I made the crouch walk and the crouch in the first place because I wanted so that way the player can go through 1 row gaps. Is there anyway to fix the issue without changing the hitbox?
You will need to change the hitbox for the crouch animations. It’s the simplest solution.
BTW, what I mean with the origin and bottom of the hit box is this:
In both animations, the green cross is the origin, the grey box is the sprite (they are the same size, so the crouch has some empty space at the top half), and the orange border is the hit box. This setup will prevent the sprites from rapidly flickering between falling and crouching.