Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: uberwolfe on April 25, 2012, 08:17:12 AM

Title: Object move away from player
Post by: uberwolfe on April 25, 2012, 08:17:12 AM
Hello,

I am very much a newb to Playmaker and game production in general, so please dont flame me if I'm missing something obvious.

I am trying to implement a basic move away from player (flee) routine into a gameobject, but am having trouble to get it to work.

Basically I have a friendly little bunny that bounces around randomly and will flee if the player gets too close.

There is an outer, and an inner trigger parented to the bunny.

Currently it goes something like this:


This issue I am having is on the last step, I am not sure how to properly face away from the player and then head away from the player for x amount of units...

Obviously an iTween "move away from" action would be ideal, but no such thing exists?

Any advice on how to implement this would be greatly appreciated, thanks  :)
Title: Re: Object move away from player
Post by: Iwa on April 25, 2012, 08:46:33 AM
Hello there,

I was just wondering first if your bunny face correctly the player before he enters the inner trigger?
Title: Re: Object move away from player
Post by: uberwolfe on April 25, 2012, 08:52:48 AM
Hi Iwa,

I use an 'iTween Look Update' action on the bunny during the outer trigger phase and it seems to track the player nicely.
Title: Re: Object move away from player
Post by: Iwa on April 25, 2012, 09:19:53 AM
Okay, so the part "rotation of 180 degrees" already works, it's the flee part wich is your problem. I've no big acknowledges (I'm maybe more newbie than you are) on playMaker but, maybe you can use the "Inverse Transform Direction" of you're bunny, to be in his own space and make him flee on adding +1 to its x or z axis (so a "Transform" Action) (it depends on where the face of your bunny is).

And if you want your bunny to do this for 3 step, then you can create a loop in your fsm :)

I'm not sure it's the best and easiest way, but that's the solution I found.

Tell me if it works well :)
Title: Re: Object move away from player
Post by: uberwolfe on April 25, 2012, 09:51:48 PM
Thanks Iwa!, I think I can't see the forest for the trees with this one...

I'll tweak it when I get home and let you know the results  :)
Title: Re: Object move away from player
Post by: justifun on April 26, 2012, 02:49:22 PM
You can use a negative number in the "move towards" action (most likely the z axis) to make it the object run away.