I hope there is someone on here that can help me with this problem.
I am making a little test car game in which the player controls the car with key presses.I have got the actionscript for the car controls and that works fine,the problem i am having with this project is the boundary actionscript.
The actionscript i have for the car is :-
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 1;
}
if (Key.isDown(Key.DOWN)) {
speed -= 1;
}
if (Math.abs(speed)>20) {
speed *= .7;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 15;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 15;
}
speed *= .98;
x = Math.sin(_rotation*(Math.PI/180))*speed;
y = Math.cos(_rotation*(Math.PI/180))*speed*-1;
if (!_root.land.hitTest(_x+x, _y+y, true)) {
_x += x;
_y += y;
} else {
speed *= -.6;
}
The boundary is basically the work space on flash mx (600 by 400),what sort of code should i use? I have tried everything that i could think of and cant get it to work… =[
If you can help then thats great and thanks in advance…