playMaker

Author Topic: Ease or interpolate for slider [SOLVED]  (Read 929 times)

Gignormaz

  • Playmaker Newbie
  • *
  • Posts: 8
Ease or interpolate for slider [SOLVED]
« on: May 18, 2020, 10:09:35 AM »
Hi all.

I'm trying to set a slider at midway and if set off, heads towards zero. A player action then adds to the slider to filling it up, combating the time limit.

What is best for this? I've had a quick go with both and managed to set it at a midway point but it keeps travelling from the beginning to the end rather than the point I've set.

I'm also struggling a little to fill it up upon action. I'm guessing I need to add to the float rather than messing with time as that would give the wrong effect.

Example:

Slider 0 - 100

Falls from 50 to 0 in 5 seconds.

Each time I press X I add another 10 to the bar

100 is the limit and nothing happens, reaching 0 sets off action.

Sorry if this hasn't been the clearest... I can try and mock something up otherwise.
Thanks  :)
« Last Edit: June 10, 2020, 06:32:39 AM by Gignormaz »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Ease or interpolate for slider
« Reply #1 on: May 19, 2020, 04:13:56 AM »
Hi.
have a separate fsm handle the float value.

On that fsm have a 'Float Add' and set value to -10 and turn on 'per second (float subtract can also be used instead)
Also turn on 'Every Frame'
below that, in the same frame you can set a 'Float Clamp'
and below that you can use a 'Set Slider Value'

Then on another fsm you can handle the button
and use 'FsmFloatAdd' (you can find this on the Ecosystem)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Ease or interpolate for slider
« Reply #2 on: May 19, 2020, 04:37:57 AM »
Hi.
Here you can see the setup :


Gignormaz

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Ease or interpolate for slider
« Reply #3 on: May 19, 2020, 06:09:15 AM »
That was really detailed, thank you. I used GIF scrubber and picked that up straight away. Really appreciate the help!   ;D

I'd almost managed to get it going but it was a spaghetti junction. This is a much cleaner method and I've managed to implement it, works great!

I've currently got it setting off when I click, what would be a good way to only activate the reduction effect on the first click? I did try a boolean changed FSM but it doesn't seem to work correctly, I think to avoid detecting first changes when loading or some such. Is there a neater method?

(It does work anyway but I'm calling a process it should just sit on over and over again which seems to me like a dirty way of doing it.)

Thanks

« Last Edit: May 19, 2020, 06:12:29 AM by Gignormaz »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Ease or interpolate for slider
« Reply #4 on: May 19, 2020, 11:37:19 AM »
Hi.
You could use a send event.

on button state set a new start state, on that state have button on click (or whatever you use)
then on the next state do a send event (by name) to the slider fsm.
and add 'Finish' Transition to that state to connect to the button Listener.

In the slider fsm set a new start state (empty) then set a local or global transition to the 'Float Value' State

Here's a  video on global/local events :