playMaker

Author Topic: Float Compare for falling death  (Read 2289 times)

stansdad

  • Playmaker Newbie
  • *
  • Posts: 18
Float Compare for falling death
« on: May 21, 2014, 04:01:50 PM »
Hi

I need an action similar to Float Compare, but to actually compare the difference between the floats, not just to see if it's less than, equal to, or more than.

i.e., I need to know if the difference between two floats is greater than 2 (a fixed value).

I'm trying to do a falling death based on Y distance fallen.  I have the Y position stored as a variable at the point of exiting one platform and again stored when they hit the next platform.

If the distance between the two is more than 2 world units, player dies.

Any idea how I can achieve this?

thanks



Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Float Compare for falling death
« Reply #1 on: May 21, 2014, 04:20:05 PM »
Hmm sounds like it would be the point where you became ungrounded (positionA) minus the position where you become grounded (positionB) then save that as the difference and if its Greater Than 2 then death.

Should be able to do a vector3 operator and a float compare on the vertical axis difference.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

stansdad

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Float Compare for falling death
« Reply #2 on: May 22, 2014, 03:00:03 PM »
Thanks Lane. I'll have a go and report back with a screenshot of an FSM that solves it.

stansdad

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Float Compare for falling death
« Reply #3 on: July 05, 2014, 07:47:55 AM »
Right I'm very close now.  It's taken me a month.  I've looked in this thread http://hutonggames.com/playmakerforum/index.php?topic=6309.0

and found the following information

Using check if is grounded. If not get inicial Y position.
Then.
Check if is grounded. If yes get final Y position.
Float Operator Inicial-Final
Float Switch between your values.
With this you can hurt/kill your player.

Tip get position in world space.

Works ok, BUT, the "death" occurs at the point my character leaves the top platform, not when he hits the floor.

I've attached a couple of screenshots.  I'm not sure if it's because of where the NO path leads on the second "Check if Grounded" state.  I also tried feeding it back into itself but get a 1000 error loop




stansdad

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Float Compare for falling death
« Reply #4 on: July 06, 2014, 03:10:32 PM »
Fixed it

Just changed the second "Check If Grounded" FSM to "Every Frame"