At 7/1/05 01:39 PM, -Toast- wrote:
Sorry for triple posting - I'm done with the 3D engine.
Should I make a AS thread about it or let someone else better than me.
No offence, but that kinda sucked.
One that I made, not completely done (only left right up and down movement) but still pretty good I think because speed is relative to the size, which is how it should be if you are going for realism.
The code (place on any MC):
onClipEvent (load) {
_x = random(550);
speed = _yscale/8;
_yscale = _y/3;
_xscale = _yscale/1.1;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if (_currentframe == 4) {
_x -= speed;
} else {
gotoAndPlay(4);
}
}
if (Key.isDown(Key.RIGHT)) {
if (_currentframe == 3) {
_x += speed;
} else {
gotoAndPlay(3);
}
}
if (Key.isDown(Key.UP)) {
if (this.hitTest(_root.wall)) {
} else {
if (_currentframe == 1) {
_y -= speed;
speed = _yscale/8;
_yscale = _y/3;
_xscale = _yscale/1.1;
} else {
gotoAndPlay(1);
}
}
}
if (Key.isDown(Key.DOWN)) {
if (_currentframe == 2) {
_y += speed;
speed = _yscale/8;
_yscale = _y/3;
_xscale = _yscale/1.1;
} else {
gotoAndPlay(2);
}
}
if (!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.DOWN) && !Key.isDown(Key.UP)) {
if (_currentframe == 5) {
} else {
gotoAndPlay(5);
}
}
}
PS, -toast-, you staeled the '--' idea from me, I know it! If you love me, just declare it rather than trying to stalk me like this.
:P