Bouncing player off a solid at an angle

Get help using Construct 2

Post » Sun Aug 18, 2013 10:51 pm

I'm making a space type game, sort of Lunar Lander/Jetpack/Thrust sort of feel.

I'm going to have the ship fly inside a cavern for instance and it will take damage if it hits a surface too hard - none of this part is a problem.

However, as I'm using custom movement, I can't work out how to get the ship to bounce off at a shallow angle when colliding. I thought about using the platform behavior but I couldn't get it working for flight as I wanted. I can get it to reverse direction to keep it out of the solid but it goes directly backwards and I want something more like skipping a stone on water.

The inverse angle of impact would be ideal but it needs to work on vertical surfaces, or whatever the particular piece of ground may be angle at.

Any ideas?
B
14
S
3
G
2
Posts: 59
Reputation: 2,180

Post » Thu Oct 10, 2013 12:33 am

Hi, just ran across an answer that worked from jangsy5. In my case, I had to add 180 to the result, but then it worked for me.

((2 * wall.Angle) - Player.CustomMovement.MovingAngle) + 180

My ship is "Player" and the wall object is "Wall". Originality at its finest. When the player collides with the wall, it calls the Custom Movement behavior, to set the angle of motion to the formula above.
B
4
S
1
Posts: 1
Reputation: 652

Post » Wed Oct 16, 2013 12:32 pm

Thanks @MobWthPitchforks, yes I bet that would have worked for me.

In the end though, I had a somewhat workable system with custom movement but I wanted to add some physics as well.
I found that mixed together they just don't work for collisions etc, I'd need to do a complete custom movement collision system and another complete physics one so I switched to just using physics instead and played with that until I got similar flight characteristics.

B
14
S
3
G
2
Posts: 59
Reputation: 2,180


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos and 28 guests