How Do I Make A Platformer Character "Bounce" Off Walls And Enemies

How do I…

How do I have a Platformer character, when pressing a certain button, “bounce” off walls and enemies-when-they’re-attacking? My main challenge has been getting the character to “bounce,” which Wall Jump mostly did well but then that became an issue with having an enemy trigger it. Ah! I have tried everything, from Wall Jump to switching to Physics 2.0 to trying to add Angle forces and X forces and change Horizontal Speed. Any ideas?

What is the expected result

I would like the character to bounce away from the wall, with increasing velocity and upward motion. The idea is the main character “spins” as an attack and when he runs into a wall, he “bounces” upward at an angle about perpendicular (but then you sort of make a parabola because of gravity, but the starting angle would be about perpendicular to the angle between the character and the spot he hit on the wall)

What is the actual result

Right now, using Forces usually results in far too much Force or just an Instant-one-frame Force. I tried having a timer with a permanent force but it still was super wonky (perhaps because Forces being applied to an object with Platformer behavior?). The closest I can get is Wall Jump but I would like to create the “bounce” myself so that it can be adjusted accordingly and with the enemy as a “wall” sometimes (but since the Enemy has Platformer behavior, that got really wonky too ha)

Related screenshots

My latest attempt lol, I know it’s super messy but I’m playing around with these settings to see if maybe I can make it work this way

(Tweaked a little more. at least it’s bouncing off the wall with some linear velocity/horizontal acceleration, seemingly in the logical direction, but there doesn’t seem to be an actual jump or vertical aspect. I may try adding a Force on Y Axis again, but that was usually a mess lol. Yea I tried that but the Instant Force just isn’t the right thing for this. I guess my main confusion at this point is how to have the “Jump” actually happen a bit upward–it seems to only really recognize the Horizontal Speed change and then lets gravity do its thing)

Any help or ideas would be appreciated!

I believe the “separate objects” event can be pretty useful for stuff like this, I think the physics engine is probably the best way to implement this, although I’m not super familiar with the mechanics so I don’t think I’m qualified to give specific advice.

So here’s where I’m at now

I feel like the horizontal speed is mostly making sense, it’s not perfect, but it’s bouncing away from the object like would happen with a bounce. And the speed/amount of time seems to work well. I’m sure I will have to play with maximum horizontal speed and deceleration when they land, but that’s for later.

Still, though, even tho it allegedly does a “simulate jump key,” and jumping again is allowed, it doesn’t look anything like the jumps I see when I just have " allow jumping again" and press the jump key over and over. I don’t get nearly as much vertical force, in fact, the “bounce” tends to go downward not up at all and that’s the main thing still missing.

If it would help I can publish the game and provide a link to see what the current “bounce” looks like?

I don’t think you can jump twice in the same event or frame. Even in sequential frames, it would be like holding the button to get the full jump time. You could change the jump speed to get more height or simulate holding the button using a timer. You’d might want to disable the players controls.

This creates a big bounce. You would need to use to left or right like you have depending on x.

Omg! It’s a great idea to " simulate pressing Left"

And yea, I only had Simulate Press Jump twice, because of some debugging/testing. My bad, didn’t mean to include that version.

That being said, this turned out to be quite good and close to what I want! A lot of tweaking still to do but I find it odd that deleting “Forbid Jump Again” worked? Like, I put it after the Allow and Simulate… plus, somehow, it doesn’t let me manually multi-jump after. Really confused by that. If anyone has an explanation, I’d really appreciate it!

1 Like