I have a problem or two in my game.
The first one is that there is an enemy that falls from the sky, and it’s supposed to start walking when hits the ground… It does, but it’s animation is broken. It rapidly switches between the walking and falling animation.
The second bug is that my game just randomly crashes and pauses. I can’t find the cause because it isn’t consistent when it happens.
Anyone have a solution?
Here’s a gif showing how to create a share link:
For the first problem:
This is probably an issue with your animations. Make sure when you write animations for a sprite, these two things are true:
- Every animation is the same size as the original sprite
- Every frame of the animation is aligned to the bottom of the image
I think #2 is probably your issue. If they aren’t aligned to the bottom, then the sprite will start to fall when the image changes. Take a look at this example to see what I’m talking about:
For the second one, there isn’t much I can do to help without some way to make the bug happen. Generally for crashing bugs it’s useful to play your game with the debugger on. That way when the crash happens it will highlight the block that caused the issue. To turn on the debugger, press the bug icon underneath the simulator.
Oh wait! I forgot to mention that I used an extension called “character” to make the animations. It’s kind of like states like not moving do this animation or facing up do this animation sort of thing.
And it keeps switching between the moving left/right state and moving down state
Yep! Both of the things I said are also true for the character extension! If you have any questions about that extension, let me know (I wrote it)
Here’s the same example using the character extension instead:
And that is EXACTLY what is happening to the enemy! wow!
I found what was making the game crash, something to do with projectiles. Fixed it!