playMaker

Author Topic: Interrupt easing process with keypress?  (Read 517 times)

George

  • Playmaker Newbie
  • *
  • Posts: 15
Interrupt easing process with keypress?
« on: January 28, 2023, 07:11:35 AM »
Hello, I am currently using easing in my game to control the speed of a video player. However, I wish to be able to interrupt the curves if the player presses a key during the execution of the action. For example, at the moment, to move the speed of the video from speed 1 to speed 5 takes, say, 10 seconds. I have to wait that full 10 seconds before I can enter another speed command, whereas I'd like to be able to choose a different speed during the transition between speed 1 and 5 or, if no key is pressed, the transition continues as normal. Here's my current process for each speed:

https://ibb.co/4V0MhSc

(I'm not sure how to insert images directly into the post, but the link works!)

Thanks in advance to anyone who can suggest a remedy for my stupidity !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Interrupt easing process with keypress?
« Reply #1 on: January 28, 2023, 10:38:13 AM »
Hi.
Have a transition on the state where you do the ease.
when button pressed transition to the next state.
on the next state you can set new values for the ease and transition back to the state with the ease.

btw, if you want different curves you can use the Tween Float action

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Interrupt easing process with keypress?
« Reply #2 on: January 28, 2023, 01:55:52 PM »
hello mate thanks for the answer i was looking for what command to use and where to put it, if that makes sense ? i am a real novice not an expert, what you are saying seems totally correct but i'm just not sure what to set the transition with ? thanks !

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Interrupt easing process with keypress?
« Reply #3 on: January 28, 2023, 01:58:15 PM »
there are 10 possible other button presses, should i listen for all of them on each event or is there a way to forward it to the (already existing) button directing table when a button is pressed so it interrupts the easing instead of going to the table once the easing has completed

in some cases, players will want to let the easing complete, but if they want to move up or down through speeds quickly it should be possible to bypass it if you see what i mean ?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Interrupt easing process with keypress?
« Reply #4 on: January 29, 2023, 01:25:49 AM »
Hi.
if you are using ui buttons, you have 'Ui Button On Click Event'
you should only listen to the buttons that should be pressed to speed up / set to next speed and probably slow down as well

try first to set it up without ease.

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Interrupt easing process with keypress?
« Reply #5 on: January 29, 2023, 04:53:03 AM »
no mate i am using keypresses not UI buttons

George

  • Playmaker Newbie
  • *
  • Posts: 15
Re: Interrupt easing process with keypress?
« Reply #6 on: January 29, 2023, 04:54:39 AM »
The main issue IS the easing, as that's what's executing and blocking any presses until it's complete. To set up without easing is simple, I am just not sure what action/placement I should use so that the system is listening DURING the ease and can respond accordingly, that's the issue I'm having.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Interrupt easing process with keypress?
« Reply #7 on: January 30, 2023, 12:23:35 AM »
Hi.
you can add Get Button for each button that you want to be able to break the easing inside the state that has the easing
if its only 1 button, use Bool Test and enable every frame and check the result of the Get Button.
if multiple buttons you can use Bool Any True for example.
Add transitions for 'Increase speed' / 'Decrease speed' for example which will be triggered when a button is 'true'


if you need a short delay for buttons to listen, then its best to make a separate fsm (call it 'ease button checker' for example.)

in the ease state, send an event (Start Listen) to the 'ease button checker' fsm.
and when going to a different state send an event (stop Listen)

on the 'ease button checker' fsm, set the 2 transition events as Global so they can be triggered any time.

on start listen state 1 use a Wait, then to the same thing with buttons but on the next state connected, send a event to the 'ease' fsm

Here is a video on global events in case you have no experience with this yet :)