Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsI'm having a problem getting a movieclip within another movieclip to react on a hitTest.
In this case the outer MC is a character, within that character is a weapon. I want an enemy MC to react on the weapon only, and not the main MC.
I have no problem solving this with a less effective method, but I can't imagine the method I'm asking for doesn't exist.
Thanks in advance
Alexander
So basically, there's A character MC, inside of that, a weapon MC. Then on the main timeline there's an enemy MC. You want to check collision between enemy MC and weapon MC.
It should be simple, it'd help if you posted the code you're currently using, but this should suffice:
if(enemyMC.hitTestObject(characterMC.weaponMC)){
//Collision
} At 3/23/10 02:54 PM, 4urentertainment wrote: if(enemyMC.hitTestObject(characterMC.wea ponMC)){
//Collision
}
Thanks for the quick reply. However, by using that method, which I've already tried numbers of different variations of, I get this Output error "TypeError: Error #2007: Parameter hitTestObject must be non-null."
Any ideas?^^
At 3/23/10 03:05 PM, snorte wrote:At 3/23/10 02:54 PM, 4urentertainment wrote: if(enemyMC.hitTestObject(characterMC.wea ponMC)){Thanks for the quick reply. However, by using that method, which I've already tried numbers of different variations of, I get this Output error "TypeError: Error #2007: Parameter hitTestObject must be non-null."
//Collision
}
Any ideas?^^
It seems as though one of the objects is not there, or can't be referenced from where you have the code. Is the code on the main timeline?
At 3/23/10 04:08 PM, 4urentertainment wrote: It seems as though one of the objects is not there, or can't be referenced from where you have the code. Is the code on the main timeline?
Yes, the code is on the main timeline. But now I get the error "#1010: A term is undefined and has no properties."
I made a mistake. I didn't realize that "weaponMC" was nested in not 1, but 2 movieclips.
So it's "characterMC > randomMC > weaponMC". I made the necessary adjustments to the code and got the error shown above ^^
So the code now shows:
if(enemyMC.hitTestObject(characterMC.randomMC.weaponMC)) {
}