playMaker

Author Topic: Need AI sprite to flip  (Read 978 times)

Jp47

  • Playmaker Newbie
  • *
  • Posts: 3
Need AI sprite to flip
« on: April 07, 2022, 08:21:22 AM »
Hey, Guys! I've read a couple posts about this problem already but I don't know how to sequence it in the FSM's. I know that I should get the enemy position and player position on the X axis and subtract them so that when the result is negative it flips left and when the result is positive it flips right. I just need help putting this into an FSM. Any help is appreciated.

andyandyandy

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Need AI sprite to flip
« Reply #1 on: April 07, 2022, 08:43:37 PM »
so you mean negative= flip image, positive = normal image?
So how about you use float compare + every frame, compare it to 0 to current float variable, is less than 0 = negative, if over or equal 0 = positive.

So the state will have "Get x axis" or watever you using to get the x, and just have compare float right under that state, make 2 events, 1 go negative, another go positive, "swap image", and basically go back to the get x axis state again.