playMaker

Author Topic: Want my player to jump high when it long pressed.  (Read 946 times)

Leesha

  • Playmaker Newbie
  • *
  • Posts: 4
Want my player to jump high when it long pressed.
« on: December 07, 2021, 01:15:20 PM »
Hi.
I really want help to setup this. I am completely new to this.
I have made a flappy bird 2d game where my bird jumps when it is pressed once like hiw normal other flappy bird works.
I want to make a little different kind fo jump.
I want my bird to jump high up when it is pressed long on screen. And it should fly till the time it is released.

Right now I have just add touch event in state 1 with phase begin. And in 2nd state I have added "add force2d" and "set velocity2d" event in that. And have just loop it.

Can anyone tell me how I set up that.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Want my player to jump high when it long pressed.
« Reply #1 on: December 08, 2021, 11:49:21 AM »
When you press the button, in the next state you can check (after a very small delay) if the button is depressed. If it is, then do a small jump. If it's not, go to the next state and wait for the button to be depressed to perform a bigger jump.

Hope this helps.
Available for Playmaker work

Leesha

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Want my player to jump high when it long pressed.
« Reply #2 on: December 08, 2021, 09:36:42 PM »
I did not understood the depressed work. How can I do that please can you explain one by one what actions should to add in what state.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Want my player to jump high when it long pressed.
« Reply #3 on: December 09, 2021, 07:46:46 AM »
Depressed = get button up.
Available for Playmaker work

Leesha

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Want my player to jump high when it long pressed.
« Reply #4 on: December 09, 2021, 08:56:38 AM »
Okay so in the first state I have to add which all actions.
Get button up and ? 
And then what do I have to add in state 2.
Should I delete those actions add force and set velocity??

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Want my player to jump high when it long pressed.
« Reply #5 on: December 09, 2021, 09:11:12 AM »
Hi.
Try This :

State 1 :
Get Button Down -> go to state 2
State 2 :
do Add force/Velocity for jumping.
Get Button Up -> go to state 3
Wait (for example 0.5) -> go to state 3


if you use force it should not be set to Impulse (try others and look what fits best for you)

Leesha

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Want my player to jump high when it long pressed.
« Reply #6 on: December 09, 2021, 09:33:21 PM »
Do I have to loop the 3rd state to 1st state ?.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Want my player to jump high when it long pressed.
« Reply #7 on: December 10, 2021, 08:59:52 AM »
Hi.
On state 3 you can Check for grounded, unless you want to be able to do multiple jumps in air.

to check for grounded, you can use raycasts or collision
then you can go back to state 1