At 7/30/08 05:18 PM, Niallmeister wrote:
It's nice of you to give us your (rather large!) code to have a gander at, but it would be helpful if you could tell us the problems that need fixing. Then we may be able to help.
he just did -_-
I have no intention of reading that entire code. So here is what I need to know:
do you have a movieclip of the terrain (you probably do), and does it look like this or this
#2 is better for hittesting.
why do you only have 8 possible rotation possibilities. You should have used a variable named angle (or w/e ofcourse), and have the ball go in the direction of the angle, like so:
_x += -Math.sin(angle*180/Math.PI)*speed; //if this doesn't work try angle*Math.PI/180
_y += -Math.sin(angle*180/Math.PI)*speed;
speed is your speed variable obviously :P. then play w/ the angle variable. for example, if hits the ceiling or the ground:
angle = -angle;
or if it hits a side wall:
angle = 180-angle;
I know this would mean you will have to change your whole AS, but 8 possible rotation possibilities is not enough.