Enemy's left and right animation

Grrr

  • Posts: 25
Hello. I'll try to be as detailed as I can. So, I've easily made controllable actor change animation and face left side when it's moving left, right side when it's moving right, but I have problem with an enemy actor, it has behavior "back and forth horizontally" and it's always facing one side. What should I do?

colburt187

  • *
  • Posts: 2416
you could use something like if X speed is > 0 switch to move right animation otherwise switch to left animation.

Siren Games

  • *
  • Posts: 102
You could also dig through the behavior you're using and find wherever it tells the enemy to change movement directions (probably Set X Speed) and right after that add in a similar block of code you used for your player (Switch Animation).  This time its just not controlled by user input.

Good luck!

Grrr

  • Posts: 25
I didn't really get it but I got one idea, I'll just count turning time and add animation frames x_x

Grrr

  • Posts: 25
I didn't really get it but I got one idea, I'll just count turning time and add animation frames x_x
Alright this method not works, it gets messy after sometime. I'm still in trouble, I'd like to see screenshot of events that makes actor move back and forth and change animation :S

ohgem

  • Posts: 42
Try this (see attached image). This is what colburt was referring to.

If the enemy speed is greater than zero, the enemy is going to the right, so switch to the right animation.  Vice versa with the left.
Follow: Twitter | Instagram
My Games: Jump Jump Fruit IOS

Grrr

  • Posts: 25
It's not moving at all that way

colburt187

  • *
  • Posts: 2416
Can you show is a screen shot of what your actors animation frames look like, Do you have a left and right animation for it that are named correctly?

Grrr

  • Posts: 25
Sure, here's everything, even scene gravity to make sure nothing stops it from moving (btw, disabling gravity didn't help either, nor did moving back and forth behavior)

colburt187

  • *
  • Posts: 2416
The behavior is deactivated?

colburt187

  • *
  • Posts: 2416
Also the xspeed should be on the left side. Currently you have if 0> xspeed

Grrr

  • Posts: 25
Also the xspeed should be on the left side. Currently you have if 0> xspeed
It was on right side on the screenshot O.o
Anyways, I moved it to left, nothing changed. Then I've activated movement behavior, still not moving. It stopped moving after I've put 0 x-speed. -_-

colburt187

  • *
  • Posts: 2416
It should also be in an always event, when created only happens once. E-mail me the game file and I can fix it. Colburt187@gmail.com

Grrr

  • Posts: 25
It should also be in an always event, when created only happens once. E-mail me the game file and I can fix it. Colburt187@gmail.com
Sent