hi all, so ive been trying to figure out how to make a platform game in flash with slopes. ive been trying to understand how to make the character rotate depending on what the angle of the ground beneath it is.ive found this method where you place to invisible points on the bottom left a right of the character image. next you check if they are intersecting with the ground or not. if they are you rotate the character to stop them from intersecting. i understand this method, but i just have no idea how to code it. anyone have some ideas? any help is welcome.
here is what i mean
You could put those 2 dots inside the character movieclip. Then, as they are part of the character they will move and rotate with it when you move and rotate the character. (So you don't have to change the positions of those dots separately.)
Everytime the character has moved (for instance every frame), you perform the hitTests as suggested in your picture. I am not sure about AS3 but, anyway, I believe in AS2 the hitTest can check if a pixel coordinate (such as the center position of one of the two dots) collides with a shape (the ground movieclip). And based on the results of those two checks you rotate the character.
It could be that in order to perform a hitTest between the position of the dot and the ground, you have to convert the location of the dot to global coordinates. This is because the dot is inside the character movieclip, so if you just use its coordinates you are actually using the (local) coordinates of the dot in the character movieclip. To convert the coordinates (to the same global coordinate space the ground movieclip is supposedly in) you would use localToGlobal.
Sadly I don't have flash at home so can't really write a demo or try my own suggestions... but maybe you can find more explanation in the help files (and/or an actionscript forum).
P.S. It occurred to me, since the hitTest would be using a coordinate, strictly speaking you don't need to add actual dot movieclips to the character, you could instead compute the required coordinates. But this is getting a bit too complicated to talk about without examples.