playMaker

Author Topic: Movement distance  (Read 769 times)

deewahyu

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Movement distance
« on: August 28, 2014, 07:52:12 PM »
Hi... i want to create a logic to decrease energy of player every specific distance of movement. For example, every 100meter of movement, the energy will decreased by 0,5 % of energy. Which playmaker's action can i use? Thanks

jess84

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: Movement distance
« Reply #1 on: August 28, 2014, 10:59:11 PM »
You probably want to calculate the time spent moving, rather than a distance - so it decreases even if the player runs around in a circle.

I would probably use a float add action and detect when my player is moving, and increase the float value. (stopping the float if the player stops moving).

then link the health value to the 'player movement' float.