playMaker

Author Topic: Measure Player Speed [SOLVED]  (Read 3408 times)

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Measure Player Speed [SOLVED]
« 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?  ???
« Last Edit: May 22, 2014, 07:34:17 AM by MajorIdea »

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Measure Player Speed
« Reply #1 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.

TrentSterling

  • Junior Playmaker
  • **
  • Posts: 89
  • Someday I'll make games!
    • My Blog
Re: Measure Player Speed
« Reply #2 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

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
Re: Measure Player Speed
« Reply #3 on: May 21, 2014, 08:15:04 PM »
very nice

MajorIdea

  • Full Member
  • ***
  • Posts: 131
Re: Measure Player Speed
« Reply #4 on: May 22, 2014, 07:33:43 AM »
That did it! Thanks a million!