I'm requesting a tutorial on slopes in platformer games. I can't find any good resources on this and my own experimenting is leading nowhere.
I request a tutorial that covers both 45 degree slopes and 23 degree slopes. Especially with player interaction, i.e how the player object would react during the collision.
Edit: Cant give a tutorial yet but I can point you to the right direction
You could modify my wall algorithm (see line.as) to do slopes at any anglehttp://forums.tigsource.com/index.php?topic=9587.msg303743#msg303743
How the collision works is that you do some vector math to get the shortest distance from a line segment (line segment is a line thats finite, starts from 0,0 and ends at 1,1 for example)
Then you can just test for this distance,
//public function getClosestPoint(point:Point):Point
distance = vector_length(getClosestPoint(player_position), player_position);
if (distance < player.width/2)
// dont move
// do move
If you want to calculate the "bounce" direction of a wall (ie. you throw a rubber ball at a wall and it bounces off)
You need to do a dot product of the wall and ball relation (figure out on what side the ball is on)
Calculate a vector going 90º degrees from the wall
normalize this vector with ball bounciness
add the vector to ball velocity