i was making a quick thing where you could use the arrow keys to drive a car around in an arena and wanted to add in other cars that moved around randomly which you could crash into.
i managed to program the player car,
code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
speed += 2;
} else {
if (Key.isDown(Key.DOWN)) {
speed -= 1;
} else {
speed *= .9;
}
}
if (Math.abs(speed)>25) {
speed *= .6;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= speed;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += speed;
}
speed *= .9;
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 *= -.5;
}
}
but i cant program the computer car to move randomly based upon the same physics.
working with flash 5, please help




Reply With Quote