Make my enemy sprite face the right direction?

I am trying to get my badguy sprite to flip when he changes directions but flipping him like I flip mySprite doesn’t work. Any ideas on where or how to code this.

3 Likes

Welcome to the forum! Let me look into your code and see the best way to do this.

This is where I come in and say:


Use @richard’s character animations extension! It allows you to design animations and it will automatically start and stop animations based on certain rules you define. But it doesn’t solve the problem of flipping them. :frowning: But if you post your image by copy and paste it here, I can flip it for you. :slight_smile:


Not related, but I only have to type git for https://github.com/riknoll/character-animations to come up lol.

image


Also not related, but I made a gist for very useful MakeCode Arcade extensions:

Hopefully, some of the extensions can help or extend your game!

1 Like

The problem is when you use badguy here:

image

You are only referencing the last “badguy” sprite created. so it will only flip one enemy. Another issue is that when the x velocity is greater than zero the image will flip constantly, making it flicker. Instead, you can just do a “flip image horizontally” whenever you change the velocity of your badguy, like so:

Hope that helps!

1 Like

That is awesome! Thanks so much Shakao!

2 Likes