Falling sprite animation conflicting with gravity effect

Hello I am new to the forum.
I am following the “How to Make a Platformer Game [Part 2: Animations, AI, collision & spawning]” tutorial https://www.youtube.com/watch?v=8DhGcCPfOU4
I am near the end of this tutorial and when my cat is standing or walking (i.e., neither falling down nor jumping up), the image continuously changes between falling cat and no change in y-axis cat.
I figured out that the gravity effect set mySprite ay (acceleration y) to 350 is conflicting with the command
if mySprite vy (velocity y) > 0
set mySprite image to [ ]
whenever the sprite is not jumping up and not falling down
If I get rid of gravity, the cat animation work fine.
QUESTION: How can I fix this problem while keeping the gravity effect?
Here is the link to my game: https://makecode.com/_WhuYCx5AkEuw
TIA for your help!

Hi @DawnofImagination !
Try just edit the image from:
image
to:
image
by selecting the marquee tool (or key M for shorcut) in sprite editor, ctrl+A, and grag whole image down to the bottom.

Why it can fix?
The prev image bottom is empty, after you set it to sprite, only solid partition considered by the phisical engine, so it is floating at that time. As the skippy.ay>0, it will begin dropping down.

Hope this helped.

Hello AqeeAqee,

Thank you so much. I did not realize that one of my sprite drawings left the cat hanging. Your fix worked perfectly!

Have a great day.

1 Like