Be a Supporter!

removeMovieClip help!!?!!

  • 260 Views
  • 8 Replies
New Topic Respond to this Topic
JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
removeMovieClip help!!?!! 2005-07-23 11:46:00 Reply

I'm making an API game, and I set up a hitTest so that when one MovieClip hits the other, they both are removed. Here's the if statement I wrote:

if (enemy.hitTest(mc)) {
removeMovieClip(mc);
removeMovieClip(enemy);
}

mc is the movieclip you control, and enemy is the movieclip that follows mc.

I want them both to be removed when enemy hits mc. With the code I wrote, nothing seems to happen, as if the code is completely ignored.

Could someone PLEASE help me!!

MJKram
MJKram
  • Member since: May. 30, 2005
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 11:48:50 Reply

Try:

if (enemy.hitTest(mc)) {
mc.removeMovieClip();
enemy.removeMovieClip();
}

that should work.
well it does for me


BBS Signature
liam0
liam0
  • Member since: Jul. 23, 2005
  • Offline.
Forum Stats
Member
Level 03
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 11:48:57 Reply

removeMovieClip is a bitch.. try putting _root on the beggining of both..

I think you can't removeMovieClips that were created at the beginning of a flash, so you can remove ones that were attachMovie'd or created in an if statement (if space is pressed for example).

I have no proof though, just my suspicions. ¬¬.

JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 11:54:11 Reply

At 7/23/05 11:48 AM, MJKram wrote: Try:

if (enemy.hitTest(mc)) {
mc.removeMovieClip();
enemy.removeMovieClip();
}

that should work.
well it does for me

Nope, it doesn't work.

PLEASE REMEMBER THAT I'M USING API, SO THE MOVIECLIPS ARE MADE DYNAMICLY!!

JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 11:55:37 Reply

If the movieclips are both on different levels, can that effect a hitTest?

JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 11:58:53 Reply

Anyone?

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 12:00:20 Reply

At 7/23/05 11:55 AM, jeremysfilms wrote: If the movieclips are both on different levels, can that effect a hitTest?

What do you ean by different levels? You mean depths?

If so, then no.. you have to use different depths :P


Sup, bitches :)

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 12:01:21 Reply

At 7/23/05 11:55 AM, jeremysfilms wrote: If the movieclips are both on different levels, can that effect a hitTest?

It shouldn't. Try this:

_root.onEnterFrame=function(){

if(enemy.hitTest(mc)) {
_root.mc.removeMovieClip();
_root.enemy.removeMovieClip();
}

}


- - Flash - Music - Images - -

BBS Signature
JeremysFilms
JeremysFilms
  • Member since: Feb. 18, 2005
  • Offline.
Forum Stats
Member
Level 18
Blank Slate
Response to removeMovieClip help!!?!! 2005-07-23 12:18:00 Reply

Thanks Denvish. It worked!