1. ## [Platformer]Slope detection/resolver

http://teamimpulse9.com/Platformer/Platformer.html (WASD to move)

I'm working on a adventure/platform game and I want to be able to include a stage with slopes and inclines.

My game works fine with flat ground and walls. What I did was create htiboxes for my charcter and if collision was detected it would calculate the angle of collision and set the charcters X velocity or Y velocity to 0. However, this method doesnt work well with inclines and slopes for obvious reasons.

Does anyone know the proper way in dealing with this? BTW, I dont think it matters but I am using BitmapData for my stage and collision (aka no hitTest).

EDIT* I found a video that breifly shows an example of slope detection in action, however there is no explanation on it's structure. http://www.youtube.com/watch?v=c9li34vNSrY (It's about 2 minutes in)
Last edited by substance; May 12th, 2008 at 03:58 PM.

2. 820
posts
Registered User
Here's a good tutorial with source code on how to use vectors:

http://www.tonypa.pri.ee/vectors/start.html

3. 8
posts
Registered User
Originally Posted by Jerryscript
Here's a good tutorial with source code on how to use vectors:

http://www.tonypa.pri.ee/vectors/start.html
sry but that doesnt help me too much i need it to be laid out for me so i can can easily do it

4. well i havnt ever done this but ive seen it where the character has a small dot in frotn of him and im guessing that when the characte hits the ground it just rotates until it has the dot hit the ground but also you should try putting your left and right movement speeds into different variables for as it is now if you walk up to the wall your stuck.

5. Originally Posted by Jerryscript
Here's a good tutorial with source code on how to use vectors:

http://www.tonypa.pri.ee/vectors/start.html
Wow, that looks EXTREMELY usefull. I've been to that site before but for some reason I remember it being mostly about tiles.

6. 557
posts
Block user.
Originally Posted by coolcat
sry but that doesnt help me too much i need it to be laid out for me so i can can easily do it
It is laid out quite clearly over multiple pages. You've just got your work cut out for you.

7. rrh
207
posts
Registered User
I'm pulling this out of the air based on the Fancy Pants video, but try it that when the right dot hits the ground, rotate the four dots upward using the left dot as the centre point, and when the left dot hits the ground rotate using the right dot as the centre point.

8. Well even though tonypa's tutorials are extremely usefull and I've learned alot after reading it over (quite a few times) his examples dont cover my specific problem.

However I did find a tutorial that looks like will explain exactly what I need. (cant look at now)

http://worldfaction.com/forums/viewtopic.php?f=18&t=178

Hope this helps others intrested in platformers as well.