playMaker

Author Topic: turning float value to negative.  (Read 2229 times)

Abdou23

  • Playmaker Newbie
  • *
  • Posts: 30
turning float value to negative.
« on: August 23, 2014, 10:36:16 AM »
So, i have a platform and want it to move right-left at random speed, it starts by moving right,and in order to get it to move left at the same speed i used a float operator : got the speed > multiply by -1 > store in new variable.

But the problem is the platform never moves in the left direction which means this method is not working.

Tried "Every Frame" on & off.
« Last Edit: August 23, 2014, 10:38:10 AM by Abdou23 »

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: turning float value to negative.
« Reply #1 on: August 23, 2014, 10:47:54 AM »
Hi!

In this case, You should not use -1, but use subtract 1 instead of multiply by -1.

Or you can use Float Add and use -1 for left and 1 for right. :)
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no

Abdou23

  • Playmaker Newbie
  • *
  • Posts: 30
Re: turning float value to negative.
« Reply #2 on: August 23, 2014, 11:07:39 AM »
Hi!

In this case, You should not use -1, but use subtract 1 instead of multiply by -1.

Or you can use Float Add and use -1 for left and 1 for right. :)

I don't think it's right, if the right speed is "3" and i subtract 1, then left speed  will be "2" , and if right is "1" then left will be "0" ,right ?!

Abdou23

  • Playmaker Newbie
  • *
  • Posts: 30
Re: turning float value to negative.
« Reply #3 on: August 23, 2014, 11:38:58 AM »
Okay problem Solved !!

I used float multiply instead of float operator, Problem now is every time the platform complete the (right-left) actions the speed gets randomised again, how t solve that ?!

Rabagast

  • Hero Member
  • *****
  • Posts: 683
    • Homepage
Re: turning float value to negative.
« Reply #4 on: August 23, 2014, 12:10:09 PM »
I'm not sure. How did you set up the FSM? I need to see it.
Check out our homepage. http://www.walsberg.no
Or my personal game blog for news about my games. http://retro-tetro.walsberg.no