goosebogey
Joined: 18 May 2004 Posts: 2
|
Posted: Tue May 18, 2004 1:26 am Post subject: First person shooter help |
|
|
I'm making a first-person shooter using this walkthrough: http://www.vecpix.com/tutorials/flash/fl009.php and I'm on the part where you use a random number technique with 'Speedy.' Instead of Speedy, I'm using a character called 'eye'. Here's my code:
onClipEvent (load) {
function reseteye() {
this._x = 650;
this._y = Math.floor(Math.random()*21+150);
speed = Math.floor(Math.random()*6)+8;
eyeCalc = 0;
this.play();
}
reseteye();
}
onClipEvent (enterFrame) {
if (!eyeCalc) {
eyeYn = Math.floor(Math.random()*200);
}
if (eyeYn == 1) {
eyeCalc = 1;
this._x -= speed;
}
if (this._x<-50) {
reseteye();
}
}
on (press) {
speed = 0;
this.gotoAndPlay("eyeShot");
}
The trouble is, when you shoot it, it just stops and doesn't reset. How can I make it do this, and how do I make a 'shot' sequence with a sound effect?[/code] |
|