playMaker

Author Topic: How to create gears for a boat with Playmaker ?  (Read 1647 times)

Bobyteal

  • Playmaker Newbie
  • *
  • Posts: 30
How to create gears for a boat with Playmaker ?
« on: January 07, 2017, 12:35:49 PM »
Hi ;)

My brain is stuck on a problem, I am trying to build a ship that moves like this :


0 gear by default.
  • You press Z => First gear => You gradually speed up forward until you reach 3 movespeed max (from your current movespeed up to 3).
...
  • You press Z again => Second gear => You gradually speed up forward until you reach 6 movespeed max (from your current movespeed up to 6).
  • ETC.

Now if you want to retro gear :
  • You press S => -1 gear  => You gradually slow down until you reach the precedent gear's movespeed max.
  • You press S starting from gear 0 => First Retrogear (-1) => You gradually move backward until you reach -1 maxmovespeed.
  • ETC.


Screenshot of my Unity :
http://imgur.com/a/2Wxr7

I hope I was clear enough, if you can help me it will be really great as it will also helps with my general understanding of playmaker !
« Last Edit: January 07, 2017, 12:46:20 PM by Bobyteal »

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: How to create gears for a boat with Playmaker ?
« Reply #1 on: January 07, 2017, 07:48:18 PM »
Sounds like you need a multiplier-

So for setting your speed float- whenever you set it- multiply it by another float that will act as a multiplier- then you just change the multiplier to set the different speeds- you can change the multiplier float from within that FSM or outside of it as well.
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Bobyteal

  • Playmaker Newbie
  • *
  • Posts: 30
Re: How to create gears for a boat with Playmaker ?
« Reply #2 on: January 08, 2017, 07:08:05 AM »
Alright I will try it but how do you make gradual speed ? I mean going from 0 to 3 speed smoothly for example, like an acceleration ?

Thanks

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: How to create gears for a boat with Playmaker ?
« Reply #3 on: January 08, 2017, 08:02:21 AM »
You'll be tracking your current speed and your target speed in variables. You can use the "Float Interpolate" action to smoothly transition your current speed up to your target speed.
« Last Edit: January 08, 2017, 08:04:32 AM by Chizzler »