playMaker

Author Topic: Why is my float setting itself to "-infinity" ? [SOLVED]  (Read 1784 times)

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Why is my float setting itself to "-infinity" ? [SOLVED]
« on: January 30, 2017, 10:21:44 AM »
I'm having real trouble subtracting on float from another.  The process should be very simple, the float starts at a fixed value of 3000, then every second it should subtact the value of another float.  But as soon as the game starts instead of subtracting the value it just sets itself to negative infinity.

Any suggestions?



« Last Edit: January 30, 2017, 12:57:09 PM by Mulbin »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Why is my float setting itself to "-infinity" ?
« Reply #1 on: January 30, 2017, 12:42:38 PM »
You could try adding a Float Clamp- and clamp the power reserve min at 0-

I've seen behavior like this if the calculation starts before the variable has been populated so it might be doing the subtract before the powerReserve variable is set?
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Mulbin

  • Junior Playmaker
  • **
  • Posts: 90
Re: Why is my float setting itself to "-infinity" ?
« Reply #2 on: January 30, 2017, 12:56:33 PM »
That's it!  Thanks, working fine now I have clamped.