How do I get enemies to animate correctly for the direction they are moving? They seem to turn left and up correctly when tracking the player movement, but right and bottom are having an issue. zombies dont turn right until I reach what I thought was the bottom threshold, and some times dont turn down at all. I tried using this:
You are not taking into account negative distances, your equation for x_diff and y_diff should be absolute value (or just take the absolute value when doing the comparison in case you want the negative number later)
So for example if the object is to the left and below the player, x_diff will be negative and y_diff will be positive, resulting in x_diff < y_diff (even if it is -5 x and +10 y)
I had it as “Change the variable x_diff set to abs(Player.X() - z1.X())” but in that case the zombies would turn up instead of down to look at player, so I took out abs and left/up worked but the other two didn’t. should I be using abs somewhere else?
found it
what would I be changing here? currently hitting the gym and can check when I’m done
Your 1st attempt was correct approach just bad execution i guess
Checking angle of movement is right option here
BUT question here is are you are moving enemies with forces or todpown behavior or pathfinding or boids?
Cause each of them have their own conditions to check angle of movement
first attempt was with boids (not shown) but couldn’t get it figured out, so I went to pathfinding and that’s where I came across the right/bottom issue. if you have a suggestion for boids or another way, I’m open to all options
Try reading it out loud, it should become clear
Once you find it then it should work as long as you put the abs() back in
Because like i told you
You used wrong conditions
This is for checking movement with FORCES
As icon indicates
OH on the disabled one, you meant my first/other attempt. you’re right, though. changed that to pathfinding angle of movement since movement is on pathfinding and it works better.
sorry, im a pt and know fitness, learning all this is a whole other language to me. biggest thing I keep doing is overlooking smaller stuff like that… truly appreciate your time.