playMaker

Author Topic: Needing help with simple platformer slope [SOLVED]  (Read 1676 times)

Just

  • Playmaker Newbie
  • *
  • Posts: 41
Needing help with simple platformer slope [SOLVED]
« on: August 14, 2020, 10:11:05 AM »
Hello, I created simple slope to slide down in platformer. It works roughly Move Towards action when pressing down arrow. When game detects that you let go down arrow button, it sends sliding event back to beginning and sliding ceases.

While playtesting, there was a wish that character could have great forward momentum during jump when sliding slope. I have great trouble to create that. Right now when pressing jump during slide, player jumps strictly upward as if character stands still.

Do you guys have idea how should I proceed to fullfill requested objective?
« Last Edit: August 16, 2020, 11:53:42 AM by Just »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Needing help with simple platformer slope
« Reply #1 on: August 14, 2020, 10:29:51 AM »
Hi.
you could use some raycast to check if you are on a  slope and if so, add some horizontal force / velocity

Thore

  • Sr. Member
  • ****
  • Posts: 480
Re: Needing help with simple platformer slope
« Reply #2 on: August 14, 2020, 11:07:37 AM »
Where you set velocity, add a state that doesn’t set velocity. If on the slope, and jumping, send an event to go to that state and stay there. You could set a bool on grounded, to return again to normal input. Or control this with a timer.

Another approach: where you get the input and set it to the variable you use, hook into that before so that you can also set it, and feed input even if the player isn’t pushing the stick.

Just

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Needing help with simple platformer slope
« Reply #3 on: August 16, 2020, 11:53:07 AM »
Thank you, I got it working! Now it gives nice boost from jumping slope!

So for anyone with similar problem later, I did following:

I created empty object, put Raycast 2D on slope. When slope Raycast is on player, it’ll next detect if player is sliding, after that, detection for a jump. If so, Add Force 2D action (my way is to put for X 0,1, Repeat Every Frame, and then Wait action for about 1 second before finish).
« Last Edit: August 16, 2020, 12:00:07 PM by Just »