Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Working on a Parkour/Wall-Run System


Recommended Posts

Hello, hope your day is going good. I'm modifying a GM Sonic engine to incorporate a type of parkour system, but I've encounted some problems.

First, let me be clear on what I'm trying to accomplish. In this engine, if Sonic runs into a wall while a certain button (Shift key for now) is held down, he will start running up the wall, similar to Sonic Lost World, but there is a key difference. In Sonic Lost World, you could only wall-run a set distance, no matter how fast you were going when you approached the wall. In my project, Sonic should maintian his speed when he starts running on a wall. So if he was walking slowly when he attached to a wall, he should barley go up before falling off. If he was blazing fast when he "parkour'ed" into the wall, he should zoom up it and make it the top of the ledge.

 

I've started getting the gist of it to work but I've run into some problems. It seems to be some sort collision problems that I can't quite figure. Instead of trying to explain it in text, I just made this quick video.



Video link.

If any one has any ideas what's happening or what I should do, I'd grealy appreciate it. Here's basic code for it (in the Step event)

//Saving the speed value when encountering the teal tiles (objParkourR), and prepping for the angle chang.
if place_meeting(x,y,objParkourR){
if keyboard_check(vk_shift) and canparkour=1 and parkour=0 and abs(x_speed) > 0
{
savespeed = +x_speed;
parkour = 1;
canparkour = 0;
}}


if !place_meeting(x,y,objParkourR){
parkour = 0;
}


//Changle the angle to 90 degree when encountering a wall while parkouring.
//Setting a timer (ptimer) that will deactivate the wall run if Sonic is moving too slow.
if parkour = 1 {
ptimer +=1
{
if place_meeting(x,y,objSolid) {
    angle          = 90;
    relative_angle = 90;
    x_speed = 0+savespeed
    savespeed -= 0.08768
    }
}}

if ptimer > 10
    {
    if abs(x_speed) < 0.1
    {
            angle=0;
            parkour = 0;
            ground=0;
            relative_angle = 0;
            ptimer = 0;
            savespeed = 0;
}}


//Reset the ability to parkour.
if parkour = 0
{
canparkour = 1
}




The engine I'm working with is a GM engine (I'm in ver8.1) and it's called "Sonic Engine Plus." I don't if anyone has experience with this engine, but it does have elements from some more common GM Sonic engines. I've reached out to the person who made the engine, but I don't know how often he checks the forum or inbox (especially considering the age of release)

You check out the engine here: link

 

Thanks!

Noah

Link to comment
Share on other sites

Hello, Noah. I have some experience with Sonic Engine Plus, I have some ideas and I think they are will help you.
Unfortunately, due to my bad English, I can't fully understand your post and especially video. It would be better if you'd tried explain it in text lol. Also I can't understand why you used a lot of local variables like 'parkour' and 'canparkour'. Instead of this, I personally tried to make Wall Run without them and just modified existing Step code. Try to find code after '// full stop when we're colliding a wall' and replace your code with my below. Hope this will works.

// full stop when we're colliding a wall
   if (x_speed > 0 && player_collision_right(x,y,angle,maskBig))
   {
      if (ground) x_speed = 0
      else if (keyboard_check(vk_shift) && y_speed<-1 && action == 1) 
      {x_speed=max(4,x_speed) action=0 ground=true angle=90 relative_angle=90 animation_direction=1}
      else x_speed = 0;
   }
   if (x_speed < 0 && player_collision_left(x,y,angle,maskBig))
   {
      if (ground) x_speed = 0
      else if (keyboard_check(vk_shift) && y_speed<-1 && action == 1) 
      {x_speed=min(-4,x_speed) action=0 ground=true angle=-90 relative_angle=-90 animation_direction=-1}
      else x_speed = 0;
   }
Edited by thevaleev
  • Like 1
Link to comment
Share on other sites

 

Hello, Noah. I have some experience with Sonic Engine Plus, I have some ideas and I think they are will help you.

Unfortunately, due to my bad English, I can't fully understand your post and especially video. It would be better if you'd tried explain it in text lol. Also I can't understand why you used a lot of local variables like 'parkour' and 'canparkour'. Instead of this, I personally tried to make Wall Run without them and just modified existing Step code. Try to find code after '// full stop when we're colliding a wall' and replace your code with my below. Hope this will works.

 

 

Hey, thanks a lot! That works so much better. That makes a lot more sense than the way I was trying to use.

 

So I was changing some parts of that code just to experiment with it. I removed the "y_speed<-1" part, because (if I'm not mistaken) it means that Sonic can only wall run when he is ascending from a jump. Removing that part made it to so that Sonic can start wall running when he's on the downward fall from a jump. I haven't noticed any problems with removing that part. Is there any reason I should be concerned about removing that part of the code?

 

There's one other thing I noticed. If Sonic rolls while wall running, he will wall run infinitely and never stop. I'm looking into it, trying to figure out how to fix this.

EDIT: So I changed the "y_speed<-1" to "x_speed>1" (or "x_speed<-1" for the other direction) and it seemed to have fixed the infinite rolling wallrun glitch.

Again, thank you so much!

Edited by noahcopeland44
  • Like 1
Link to comment
Share on other sites

No problem man, I always glad to help. Also I glad that you fixed infinite roll glitch. I was about to give my variant for solving this problem though. Anyway, if you don't mind I will post it there. I just added another 'counter' timer variable called counted[4] and placed it into Wall Run code and Rolling Action code. This one doesn't allowing to do Wall Run for a very quick moment after falling from a wall while rolling.

...
else if (keyboard_check(vk_shift) && counter[4]=0 && action == 1) //oh look there's new counter[4]=0 code
...
if (counter[4]>0 && ground) counter[4] -= 1; //place it after wall jump code
...        
if ( action == action_rolling )       
 {            
attack = true;            
counter[4] = 5; //don't let counter shut off while player's rolling
...

Removing that part made it to so that Sonic can start wall running when he's on the downward fall from a jump. I haven't noticed any problems with removing that part. Is there any reason I should be concerned about removing that part of the code?

I just wanted to give more reality sense with this. I feel like it'd be confusing if Sonic can do Wall Run up while falling down at high speed.

Edited by thevaleev
Link to comment
Share on other sites

 

I just wanted to give more reality sense with this. I feel like it'd be confusing if Sonic can do Wall Run up while falling down at high speed.

 

Oh I see. You're right, that would be odd. I don't know why I didn't think of that. And thanks for the inifinite roll fix. I'll try that one out to see if it works better, though the end result will probably be the same. Thanks again!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...