00:00
00:00
Newgrounds Background Image Theme

BorfDoggo just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

As Help! 2006-08-10 10:11:49


I have everything else working but my bullets doesn't "kill" enemies. I'm using this HitTest script in my "enemy1":

onClipEvent (enterFrame) {
if (this.hitTest(_root.bullet1)) {
_root.removeMovieClip();
}
}

I've checked instance names and they were right.

Response to As Help! 2006-08-10 10:20:03


At 8/10/06 10:11 AM, Norton3000 wrote: I have everything else working but my bullets doesn't "kill" enemies. I'm using this HitTest script in my "enemy1":

onClipEvent (enterFrame) {
if (this.hitTest(_root.bullet1)) {
_root.removeMovieClip();
}
}

You can't remove the _root >.<

You need to specify the clip you want removing:

this.removeMovieClip();


BBS Signature

Response to As Help! 2006-08-10 10:23:56


or _root.enemy1.removemovieclip()

or not?

<3

Response to As Help! 2006-08-10 10:24:38


Hmm... Still doesn't work.

Response to As Help! 2006-08-10 10:41:36


Here is the script from the "bullet1":

onClipEvent (load) {
spd = 50;
// bullet speed
_x = _root.Player1._x;
// Move to player _x
_y = _root.Player1._y;
// Move to player _y
_rotation = _root.Player1._rotation;
// Point in same direction as player
}
onClipEvent (enterFrame) {
if (_name == "bullet1") {
_x = -1000;
// Move the original bullet MC offstage
} else {
// Run this movement code on all dupes
if (_rotation>180) {
_y += (spd*Math.cos(Math.PI/180*_rotation));
_x -= (spd*Math.sin(Math.PI/180*_rotation));
} else {
_y -= (spd*Math.cos(Math.PI/180*_rotation));
_x += (spd*Math.sin(Math.PI/180*_rotation));
}
// if(hitTest(_root.enemy)){ blahh; } Not going to address this here, check AS: Main for hitTest threads.
}
if (_x>Stage.width || _x<0 || _y<0 || _y>Stage.height) {
// If off-stage, delete the dupe to save CPU
this.removeMovieClip();
}
}

And here is the code from frame:

var bc = 1000;
// bulletcount
_root.onMouseDown = function() {
bc++;
if (bc>1010) {
bc = 1000;
}
// Reset bulletcount
duplicateMovieClip("bullet1", "b"+bc, bc);
// Create dupe bullet
};

Response to As Help! 2006-08-10 10:45:39


At 8/10/06 10:24 AM, Norton3000 wrote: Hmm... Still doesn't work.

You can only remove MC's that have a depth above 0. Try this:

this.swapDepths(9999);
this.removeMovieClip();

Response to As Help! 2006-08-10 11:40:33


It's because the duped bullets don't have the instance name of bullet1. They're named b1000-b1010.
onClipEvent (enterFrame) {
for(n=1000; n<1010; n++) {
if (this.hitTest(_root["b"+n])) {
this.swapDepths(9999);
this.removeMovieClip();
}
}

Response to As Help! 2006-08-10 12:25:11


just go to the AS: Main thread by Denvish and find what you looking for.


Charlie: I'm about to show you the white-hot cream of an 8th grade boy.

Response to As Help! 2006-08-10 12:35:27


i got some suggestions...

dont use this... specify the name of the movieclip...
for example... _root.bullet.hitTest(_root.enemy)

oh and try any of these:
_root.enemy.removeMovieClip();
removeMovieClip(_root.enemy);

if we arent any help... try searching for answers HERE

Response to As Help! 2006-08-10 12:47:35


and if i want to shot just 3 bullets????