Hello I am making a golfing game and am trying to get the ball to change its angle when it hits the lvl wall. The lvl is a diffrent shape on each hole so I have spent a few days trying to think of how to make this happen and finally came up with somthing but the varibale isnt working so can some one please help. I am using ActionScript 2.0 and this is what I have as an idea. When the club is released to hit the ball the var num is set to 1 since this is the first x and y axis in this set of bounces. I then set newx_+_root.num = _root.ball.x and newy+_root.num = _root.ball.y, then I increment num++ so that when the ball does a hit test for when it hits the wall newx+_root.num = _root.ball.x and newy+_root.num = _root.ball._y are set again but this time num is = 2 since it is the second axis needed to preform the angel change. Also on the ball to wall hit test i want to campare the newx_x and newy_y to the to the newx_x-1 and newy_y-1 to see how the angle needs to be changed.
This is the code i am working with atm.
when the club is released
root.num=1;
var newx+_root.num = _root.ball.x;
var newy+_root.num = _root.ball._y;
_root.num++;
when the ball hits the lvl wall
var newx_+_root.num = _root.ball.x;
var newy+_root.num = _root.ball.y;
if(newx+root.num > newx+(_root.num-1)){
ball.x = xspeed;
}else if(newx+root.num < newx+(_root.num-1)){
ball.x = xspeed*-1;
}else if(newy+root.num > newy+(_root.num-1)){
ball.y = yspeed;
}else if(newy+root.num < newy+(_root.num-1)){
ball._y = yspeed*-1;
}
_root.num++;