Need help with space ship ... im SOOO close...!

:smiley: - hello!

i wonā€™t post the file yet - ive got to get the size down before i can post it. actually, ill put it here:

www.mark-stuckert.net/HEREHERE/

size wont fit hereā€¦ but hereā€™s the actionscript on the spaceship:

/////

[size=1]onClipEvent (load) {
thrust = 1;
decay = .99;
maxSpeed = 5000;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_rotation += 10;
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 10;
}
if (Key.isDown(Key.UP)) {
xSpeed += thrustMath.sin(_rotation(Math.PI/180));
ySpeed += thrustMath.cos(_rotation(Math.PI/180));
flames._visible = 1;
} else {
xSpeed = decay;
ySpeed = decay;
flames._visible = 0;
}
if (Key.isDown(Key.DOWN)) {
xSpeed -= thrust
Math.sin(_rotation
(Math.PI/180));
ySpeed -= thrustMath.cos(_rotation(Math.PI/180));
flames._visible = 0;
} else {
xSpeed = decay;
ySpeed = decay;
flames._visible = 0;
}
speed = Math.sqrt((xSpeed
xSpeed)+(ySpeed
ySpeed));
if (speed>maxSpeed) {
xSpeed *= maxSpeed/speed;
ySpeed *= maxSpeed/speed;
}
_y -= ySpeed;
_x += xSpeed;
if (_y<0) {
_y = 612;
}
if (_y>612) {
_y = 0;
}
if (_x<0) {
_x = 792;
}
if (_x>792) {
_x = 0;
}
}
onClipEvent (enterFrame) {
if (_root.ship, hitTest(_root.BARMC3)) {
xSpeed = -xSpeed;
ySpeed = -ySpeed;
}
}

[size=2]/////

:worried: - my problems are as follows:

  1. The spaceship speed (forwards and in reverse) decay to a certain point, but then reach this extremely minimal speed wherein they go on forever. not a big deal, but kind of annoying!

  2. when this happens:

[/size][/size][size=1]onClipEvent (enterFrame) {
if (_root.ship, hitTest(_root.BARMC3)) {
xSpeed = -xSpeed;
ySpeed = -ySpeed;

[size=2]the bounce gets more and more minimal if you hold the key (either up or down arrows) and it eventually starts hammering through the ā€œBARMC3ā€ until it plows through the other side.

So, as youā€™re all brilliant, hereā€™s what Iā€™m looking for:

1 - For the spaceship, in forward or reverse, to decay nicely and stop.
2 - For the spaceship to bounce nicely off of the BARMC3 (btw, just a little horizontal bar), but never plow through - I suppose it would get to a point where it would just keep bouncing?

Well, thanks for your time and consideration. Thereā€™s no rush on this, and Iā€™m relatively new to Flash, so Iā€™m in way over my head.

Thanks,

Mark Stuckert (decisionman)

[email protected]
http://www.mark-stuckert.net

PS - the decay seems to eventually reach 0 speed when going in reverse, but it never stops when going forwardā€¦

PPS - for some reason i have to save this as a MX file, not an MX2004 for the spaceship to workā€¦ donā€™t ask me whyā€¦

(thanks!)

[/size][/size][size=1][size=2]

[/size]

[/size]