PDA

View Full Version : shooting


Swas
12-04-2004, 08:55 AM
the driving portion of the game im making

been racking my brain for ages, everything is working apart from the shooting

http://mercury.walagata.com/w/swasa/carMx.swf

basically i cant figure out how to get more than one bullet on the screen and how when its on the screen to stop following the mouse please help im gonna speed up the bullet but waiting for a reply first

thanx, -swasa

c00lryguy
12-04-2004, 09:28 AM
Hey, can I see the shooting code?

I may have a solution

Swas
12-04-2004, 09:34 AM
yes



onClipEvent (load) {
this._visible = false;
}
onClipEvent (enterFrame) {
this._x += 10;
}
onClipEvent (mouseDown) {
this._visible = true;
i = i+1;
duplicateMovieClip(this, "bullet"+i, i);

this._x = _root.back.char.gun.gunend._x;
this._y = _root.back.char.gun.gunend._y;
}

c00lryguy
12-04-2004, 09:43 AM
I'm guessing this is in the bullet code?

instead of using "this" try using ["bullet"+i]

Swas
12-04-2004, 09:58 AM
i edited it

onClipEvent (load) {
this._visible = false;
}
onClipEvent (enterFrame) {
this._x += 10;
}
onClipEvent (mouseDown) {
this._visible = true;
i = i+1;
duplicateMovieClip(this, "bullet"+i, i);

["bullet"+i]_x = _root.back.char.gun.gunend._x;
["bullet"+i]_y = _root.back.char.gun.gunend._y;
}

basically the same but did what you said now it only fires every couple of clicks and dissapears when after about 2 seconds
[/code]

c00lryguy
12-04-2004, 10:02 AM
yeah actionscript is really weird

try putting the "i = i+1;" after the bullet dupe like:


onClipEvent (load) {
this._visible = false;
}
onClipEvent (enterFrame) {
this._x += 10;
}
onClipEvent (mouseDown) {
this._visible = true;
duplicateMovieClip(this, "bullet"+i, i);
i = i+1;
["bullet"+i]_x = _root.back.char.gun.gunend._x;
["bullet"+i]_y = _root.back.char.gun.gunend._y;
}

Jonanin
12-04-2004, 12:33 PM
Actionscript isn't weird... you just aren't doing it right ;)

Swas
12-05-2004, 06:08 AM
actually ... i was i fixed it so nah nah :lol: the only thing i cant figure out is how to stop it following the mouse but o well

*edit*

heres what i got now

http://mercury.walagata.com/w/swasa/carMx.swf walk around try shooting in different places there different shadows and things just need to figure out the not following the aim still anyhelp wud be loved

onClipEvent (load){
i = 0;
}
onClipEvent (enterFrame) {
this._x += 50;
if (this._x > 550){
this.removeMovieClip ();
}
}
onClipEvent (mouseDown) {
this._visible = true;
duplicateMovieClip(this, "bullet"+i, i);
["bullet"+i]_x = _root.char.gun.gunend._x;
["bullet"+i]_y = _root.char.gun.gunend._y;
i = i++;
}

eatmorchikin6464
12-05-2004, 10:19 AM
Wtf is the driver doing? And, can you move the car at all?

Swas
12-05-2004, 10:56 AM
wisteling and tapping on the side of the car, you cant move the car yet im gonna get the shoot right first

c00lryguy
12-05-2004, 11:32 AM
I'm telling you, try api, it'll fix your bullet problem

Swas
12-06-2004, 11:52 AM
i have started it with the spare time i got and it is useful very infact :D made a sig quickly with it