Easy Spaceship Game
Try this "Easy Spaceship Game" - click on the pic to the left
<-----------------------------
Here's the Action Script code you'll need
<-----------------------------
Here's the Action Script code you'll need
onClipEvent (load) {
yspeed = 0.85;
xspeed = 0.85;
wind = 0.00;
power = 0.65;
gravity = 0.0;
upconstant = 0.85;
friction = 0.99;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed = xspeed-power*upconstant;
}
if (Key.isDown(Key.RIGHT)) {
xspeed = xspeed+power*upconstant;
}
if (Key.isDown(Key.UP)) {
yspeed = yspeed-power*upconstant;
}
if (Key.isDown(Key.DOWN)) {
yspeed = yspeed+power*upconstant;
}
xspeed = (xspeed+wind)*friction;
yspeed = yspeed+gravity;
_y = _y+yspeed;
_x = _x+xspeed;
_rotation = _rotation+xspeed;
if (_root.wall_1.hitTest(_x, _y, true)) {
xspeed = 0;
yspeed = 0;
_x = 75;
_y = 140;
}
if (_root.wall_2.hitTest(_x, _y, true)) {
xspeed = 0;
yspeed = 0;
_x = 75;
_y = 140;
}
if (_root.Insert_Instance_Name_Here.hitTest(_x, _y, true)) {
xspeed = 0;
yspeed = 0;
_x = 75;
_y = 140;
}
if (_root.exit.hitTest(_x, _y, true)) {
_root.gotoAndStop(2);
}
if (_root.exit_2.hitTest(_x, _y, true)) {
_root.gotoAndStop(2);
}
}
______________________________________________________________________________________________________
The code is actually correct, ensure that you give all your symbols the correct instance names.
To add a 2nd level:
onClipEvent (enterFrame) {
if (this.hitTest(_root.char))
{
_root.gotoAndStop();
}
}