Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: keitaro3660 on December 18, 2014, 12:24:58 AM
-
hellooo
i currently get really stuck with the 2D AI movement..
how can the AI know if the player is behind him? and he must "FLIP" the sprite before "Move Toward" the player. not walking backward...
Look At 2D is not the solution, because it's rotate, not flip...
while Get Distance value is always give positive value, so the AI "SPRITE" won't know if the player is in front of him or behind him.
how should he know WHEN he must face/flip backward or not??
i want to make the enemy following player with the right FLIP.
i know it's something to do with the X scale. i just don't know what i must use to achieve this.
i really don't know what should i use, have been stuck for a while with this.
please help me, please step by step for what action should i use
-
You could...
Get the enemies Xposition
Get the players Xposition
Subtract the enemies Xposition from the players Xposition
Compare the results, greater than 0 would set the Xscale to 1 and less than to -1.
-
You could...
Get the enemies Xposition
Get the players Xposition
Subtract the enemies Xposition from the players Xposition
Compare the results, greater than 0 would set the Xscale to 1 and less than to -1.
wow okay cool, thanks for reply :D i'll try it now
-
Let me know if it works ... in my head it does :P
-
Let me know if it works ... in my head it does :P
looolll, silly meee XD
the first time i tried your solution, i thought the Get Position space is set to Self.
It's working, but a bit weird because sometimes the value is always stay positive if the player is near.
i strugle for 30 minutes, then i try to change the Self to World, and....
VOILA!!!!
lol, silly me...
really thanks so much for your help!!!
this move towards feature really usefull for many things now XD
thank youuu thank youuu!!