Player Movement

Started by
3 comments, last by white_waluigi 10 years, 11 months ago

i've got the following Problem:

im making a 2D not Tile-Based game with Collision Lines in all directions and sizes. Now when the Player moves along a 40 degree Line for example, his movment speed decreases dramaticaly, so i set down the Gravity. but then if the player moves in the opposite direction, he flies of the surface.

How could i solve thies Problem?

I thought about implementing a System, that, if the player is on a surface, lets him move along the surface, but that caused me a lot of other problems. How do other People solve this kind of Problem?

Advertisement

You say that you have gravity - is it a top-down view or a side view? How is the gravity affecting your movement?

Can you be a bit more specific on how you currently calculate your movement?

its top down and the gravity is alawys 1m/s, so the player is always falling, but the player gets on the surface by resolving the collision. Movement is 1 m/s right now which means the effect drops by 45 degrees.

How do you resolve the collision?

Lets say the player is penetrating a plane.

If you push the player out in direction of the plane normal it should slide down slopes on its own, which is probably not what you want.

If you push the player out vertically, it will stay in position and gravity should also not affect the movement speed.

i avoided the sliding by adding fraction

so your telling me top just resolving the collision vertically or horizontal?

k ill try it out

This topic is closed to new replies.

Advertisement