Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by fulvio

I'm about to code some wall sliding functionality into my platformer and was just wondering whether anyone has successfully done this already and could share some input or code?

If not, wish me luck! I'll provide some progress along the way.

1 decade ago by mLautz

You may need to be a little more specific. Do you just want to have your player somewhat grip a wall when they jump on it?

I dabbled with writing some double jump code in my first game but eventually left it out. What I did though, was decrease the players y vel when they came in contact with a vertical wall.

A quick example below:

handleMovementTrace: function(res){
                        this.parent(res);
.
.
.

                        if(res.collision.y){
                                //handle wall collision here
                                this.vel.y = 30;
                        }
                },

I may be able to provide a better estimate for this if I knew more about your goal :)

1 decade ago by fulvio

Thanks for the example @mLautz. I think you mean res.collision.x though :)

To answer your questions about specifics. If you've ever played the game League of Evil on iOS you'll know what kind of wall jumping I'm after.

Basically I'd like to be able to climb a wall by jumping onto it and then slowing down the velocity like you said and also to be able to jump from wall to wall if they're close together.

1 decade ago by mLautz

Yes! I did mean res.collision.x. Silly me....

I remember now that I had difficulties with the above approach in that the collision for me would only register if the player maintained a velocity pointing in to the wall. (eg: If I jump right onto a wall and release the right direction expecting to slide down, normal velocity returns).

I also had issues as far as the fine tuning of jumping off of the wall and the way that my jumps worked. I'd be curious to see how you handle the whole process. I haven't had time to go back and revisit it.
Page 1 of 1
« first « previous next › last »