The McLeodGaming forums were permanently closed on April 30th, 2020. You are currently viewing a read-only archive.
View unanswered posts | View active topics It is currently Fri May 15, 2020 5:37 am

Forum rules


IMPORTANT

This Forum is for Flash related questions ONLY! Do not ask questions about spriting, Game Maker, Photoshop, or anything else not related to Flash.



 [ 10 posts ] 
[Question] Duplicate Hit Testing 
Author Message
User avatar

Joined: Tue Oct 28, 2008 1:37 pm
Posts: 300
Well basicly I was wondering if it's possible to make a duplicate colide with another duplicate.

_________________
Image
super smash bros blits(working title)-1% done
new flash game


Mon Mar 15, 2010 12:08 pm
User avatar

Joined: Mon Aug 11, 2008 1:09 pm
Posts: 166
Location: England lol
Gender: Male
Currently Playing: Minecraft
Well I am assuming that you used duplicateMovieClip() to create the duplicates. So let's say you made a loop that creates 5 duplicate movie clips each with the instance name dupe1, dupe2, dupe3...

To add the hitTest to each one, another loop could be used like so:

Code:
for(i=1; i<6; i++) {
  if(_root["dupe"+i].hitTest(_root.hitMC)) {
    //Your code here
  }
}


This should work, but its mainly the _root["dupe"+i] part which you are focusing on. Hope this helps


Mon Mar 15, 2010 9:55 pm
WWW
User avatar

Joined: Tue Oct 28, 2008 1:37 pm
Posts: 300
Well i havnt got flash on this comp to test this out, but it looks to me as if it's hitTesting with a normal mc. Basicly i want it to hitTest with another duplicate. (if i had flash with me i'd be able to trial and error this).

_________________
Image
super smash bros blits(working title)-1% done
new flash game


Wed Mar 17, 2010 3:01 pm
User avatar

Joined: Mon Aug 11, 2008 1:09 pm
Posts: 166
Location: England lol
Gender: Male
Currently Playing: Minecraft
bowser guy wrote:
Well i havnt got flash on this comp to test this out, but it looks to me as if it's hitTesting with a normal mc. Basicly i want it to hitTest with another duplicate. (if i had flash with me i'd be able to trial and error this).

The _root["dupe"+i] part is basically looping through any duplicates of a movie clip... say you have a movie clip calld "mymc1", then you duplicate it and call it "mymc2", and again "mymc3" and so on... this would refer to all of them with the same code.


Fri Mar 19, 2010 7:51 pm
WWW
User avatar

Joined: Tue Oct 28, 2008 1:37 pm
Posts: 300
Code:
onClipEvent(load){
      _root["mcno1"+i]._x=_root.mcno2._x
   _root["mcno1"+i]._y=_root.mcno2._y
}
}

dosnt work :cry:

_________________
Image
super smash bros blits(working title)-1% done
new flash game


Fri Apr 02, 2010 8:01 am
User avatar

Joined: Mon Jul 06, 2009 11:54 am
Posts: 57
Gender: Male
bowser guy wrote:
Code:
onClipEvent(load){
      _root["mcno1"+i]._x=_root.mcno2._x
   _root["mcno1"+i]._y=_root.mcno2._y
}
}

dosnt work :cry:

You Tried Putting it in the first frame of the movie clip?

_________________
Best Website's For Mugen Characters
http://www.mugencharacters.ucoz.com
& http://mugeninvasion.ucoz.com/load/3-1-0-6
ImageImageImage
My Youtube: http://www.youtube.com/reashun14
I PLAY COMBAT ARMS ONLINE!
Image


Mon Apr 05, 2010 1:27 am
WWW
User avatar

Joined: Tue Oct 28, 2008 1:37 pm
Posts: 300
Reashaun14 wrote:
bowser guy wrote:
Code:
onClipEvent(load){
_root["mcno1"+i]._x=_root.mcno2._x
_root["mcno1"+i]._y=_root.mcno2._y
}
}

dosnt work :cry:

You Tried Putting it in the first frame of the movie clip?

Errrmm. Ye, maybe it's because the other bit of code. Here it is all together.
Code:
onClipEvent(load){
   i=0
}
onClipEvent(enterFrame){
   if(Key.isDown(Key.SPACE)){
      duplicateMovieClip(_root.mcno1, "mcno1", i)
      i+=1
   }
}
onClipEvent(load){
      _root["mcno1"+i]._x=_root.mcno2._x
   _root["mcno1"+i]._y=_root.mcno2._y
}

edit: it duplicates but thats it.

_________________
Image
super smash bros blits(working title)-1% done
new flash game


Mon Apr 05, 2010 8:13 am
User avatar

Joined: Mon Jul 06, 2009 11:54 am
Posts: 57
Gender: Male
bowser guy wrote:
Reashaun14 wrote:
bowser guy wrote:
Code:
onClipEvent(load){
_root["mcno1"+i]._x=_root.mcno2._x
_root["mcno1"+i]._y=_root.mcno2._y
}
}

dosnt work :cry:

You Tried Putting it in the first frame of the movie clip?

Errrmm. Ye, maybe it's because the other bit of code. Here it is all together.
Code:
onClipEvent(load){
   i=0
}
onClipEvent(enterFrame){
   if(Key.isDown(Key.SPACE)){
      duplicateMovieClip(_root.mcno1, "mcno1", i)
      i+=1
   }
}
onClipEvent(load){
      _root["mcno1"+i]._x=_root.mcno2._x
   _root["mcno1"+i]._y=_root.mcno2._y
}

edit: it duplicates but thats it.

Well does it work?
If it doesnt did you try naming the instance of the 2 movie clips?
for the first one mcno1
and for the second on put the instance mcno2

_________________
Best Website's For Mugen Characters
http://www.mugencharacters.ucoz.com
& http://mugeninvasion.ucoz.com/load/3-1-0-6
ImageImageImage
My Youtube: http://www.youtube.com/reashun14
I PLAY COMBAT ARMS ONLINE!
Image


Mon Apr 05, 2010 4:22 pm
WWW
User avatar

Joined: Sun Sep 28, 2008 6:46 pm
Posts: 51
Gender: Anime Girl
I think I could help out a bit, but I would like to know exactly what do you mean?
Are these dubed MC's hitting a floor or are they attack each other :/
If I could get the situation you're trying to create i could give some better help.

_________________
Would you kindly go here clicky and read at least the first few paragraphs
Image


Mon Apr 05, 2010 8:46 pm
User avatar

Joined: Tue Aug 12, 2008 2:07 pm
Posts: 39
bowser guy wrote:
Code:
onClipEvent(load){
      _root["mcno1"+i]._x=_root.mcno2._x
   _root["mcno1"+i]._y=_root.mcno2._y
}
}

dosnt work :cry:


from what it looks like to me what you are trying to do is duplicate mcro right?
i think you should try using

_root["mcno"+i]._x=_root.mcno2._x
_root["mcno"+i]._y=_root.mcno2._y
}[/code]

what you were trying to do was duplicate mcno1 by putting +i it added a number to the end of mcno1 which would give you something like mcno11, mcno12 and so on
tell me if it helps ok

_________________
get free wii points here!


Wed Apr 14, 2010 1:39 pm
Display posts from previous:  Sort by  
 [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF.