Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: MajorIdea on May 21, 2014, 11:10:51 AM

Title: Measure Player Speed [SOLVED]
Post by: MajorIdea on May 21, 2014, 11:10:51 AM
Hi all,

I'm trying to make a simple top down game where the player is followed by baddies. The way the player moves is by dragging the mouse across the screen, and the character follows the mouse nearly 1:1.

I need the baddies to move at the same speed the player is moving. So if you move the mouse quickly the baddies will also speed up to match the player speed. The thing is - I can't find a way of measuring the player speed.

I'm using Mouse Pick and Move Towards to move the player to where the mouse is, and I've tried Get Speed and Get Velocity (with a rigidbody on) to measure the speed every frame and have that float variable control the speed of the baddies. But all I'm getting is a weird number on the Y axis (goes from -7 to -9) that has no relation to the way the player moves.

Help?  ???
Title: Re: Measure Player Speed
Post by: caesarhernandez on May 21, 2014, 06:55:07 PM
You could give the baddies an FSM that constantly executes a GetDistance between themselves and the player. If the distance increase, you increase their velocity.
Title: Re: Measure Player Speed
Post by: TrentSterling on May 21, 2014, 07:58:01 PM


Following a request, here's n action that get the speed of any gameObject, it doesn't require a physics component attached.


http://hutonggames.com/playmakerforum/index.php?topic=1182.msg4961#msg4961
Title: Re: Measure Player Speed
Post by: caesarhernandez on May 21, 2014, 08:15:04 PM
very nice
Title: Re: Measure Player Speed
Post by: MajorIdea on May 22, 2014, 07:33:43 AM
That did it! Thanks a million!