- 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 -= thrustMath.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((xSpeedxSpeed)+(ySpeedySpeed));
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]/////
- my problems are as follows:
-
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!
-
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)
mark.stuckert@gmail.com
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]