Crouch help

I’m trying to make a Mario game and I plan on adding crouching but I cant figure out how to work it pls help

Hi! One problem that I can see is that you aren’t undoing the effects of pressing down. After pressing down, you should have a check somewhere, probably in a Forever loops, that resets this if the Down button is no longer pressed. Another issue is that the crouching while moving animation repeatedly changes the size of the character, making it bounce up and down, which causes jumping to not work sometimes because sometimes the player is not technically touching the ground. I would do something to make the animation smoother, like making both frames have the same character height. So far this looks really good and I’ll be happy to maybe see it finished some day! Good luck!

1 Like

Game Update would be better

1 Like

can you show me in blocks?

1 Like

@WoofWoof are you able to show me in blocks? I’m a visual learner

1 Like

An easier way to do this is to use the button pressed and released events and swapping the animations you are using when the button state changes. I would not use the “facing down” options from the character animations extension, that’s really just for top-down games and not platformers

Let’s start by creating a function for this. It’s going to take in two arguments: a sprite to set the animations on and a boolean that indicates whether we should use the crouched animations or the uncrouched animations:

image

Now inside the function, we can use an if statement to handle the two cases:

image

Now add animation blocks in each of the if cases:

and repeat for all of the different movement cases (facing right + moving, facing left + not moving, facing left + moving, etc.).

Once you have the function done, you can delete the animations in your on start and instead call your function:

image

And also call that function inside of button pressed/released events:

image

3 Likes

What Richard said :sweat_smile:
I was busy and was going to do this later, but I guess I no longer have to :smile:

Oh Thanks but I also make different things like a 2 player version and I need the code to work for individual players
(also can @MakeCode add were you can take assets from other games you’ve mad I really need it)

@mcodes same code should work for multiple players, you just need to add another function that sets the “luigi” animations