substance
May 12th, 2008, 03:42 PM
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)
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)