Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: dharry on July 16, 2015, 02:25:31 AM
-
Hi All, new to Playmaker so please bare with me :)
I am making a 2d top down game. I have a sprite with 4 animations (using animator), 1 for left, 1 for right, 1 for up and 1 for down.
I can't seem to work out how to get the right animation to display, or the right orientation of the sprite depending on which direction the sprite is moving...
Can anyone point me to an example project or offer any help?
Thanks
Dean
-
Hi,
you could expose 4 boolean animator properties and then based on the user input, you trigger each animator property accordingly.
make sure you get the Mecanim package for PlayMaker on the wiki (https://hutonggames.fogbugz.com/default.asp?W1031) or Ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181) to be able to control animator properties.
Bye,
Jean
-
Thanks Jean,
My problem is not my character, I have that working perfectly... my problem is my game enemies, they follow a pre-defined path so they have no input to be able to watch for.
Dean
-
Hi,
then use the velocity and get the angle the velocity makes from the forward axis of your gameobject, this will be your direction of movement, expressed in degrees, so then if it's between -45 and 45 it's forward, 45 to 135 it's right, etc etc.
I know as well that Unity has a sample showing a mecanim setup where it does that automatically by just feeding it with the angle.
https://www.assetstore.unity3d.com/en/#!/content/5328
check the minebot animator setup, it's complex but is very close to what you want.
also check this thread, it has a mecanim system using direction, it's very close to what you can do with your enemy.
http://hutonggames.com/playmakerforum/index.php?topic=5161.msg24546#msg24546
Bye,
Jean