Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 ViewsI have multiple MC's and there all attached to the screen dynamically (attachMovie();) and there in seperate groups A and B, when A encounters B or vise versa A and or B attacks the other, but what my problem is, since i cannot apply a hitTest code on each one if they hit each of the enemies attacks, i was wondering if there was a way if you could apply a hitTest via a linkage ID IE
if ("Linkage ID".hitTest("annother Linkage ID){
deduct life
}
If thats possible, please let me know, ATTACHED PROBLEM, Is there a way to attach a code to a dynamically attached MC, if so how? IE _root.location.attachMovie("MC_ID","MC",
10+=MCcount);
"MC".(insert actions)
because i cannot seem to apply a code like
_root.(attached MC)._x +=12; or something. So if anyone has any help on either problem, lemme know.
One way (and one of the better ways) to do it is store all of the enemies/objects in arrays and and use that.
If enemies and bullets are 2 arrays filled with things on screen;
for(i = 0; i < enemies.length; i++)
{
for(j = 0; j < bullets.length; j++)
{
if(enemies[i].hitTest(bullets[j]))
{
//stuff
}
}
Perpetually looking for time to return to the arts.
I think I get what your sayin' I'll try that out
I'm still not entirely sure what to do, if anyone can still help me out.
what he's saying is store all the items you added into an array and then loop through the arrays to carry out a hitTest
i assume AS3, since you can use instance names on AS2
var AAray:Array = new Array ()
var BArray:Array = new Array ()
function AddA ()
{
var item:A = new A()
addChild (item)
AArray.push (item)
}
function AddB ()
{
var item:B = new B()
addChild (item)
BArray.push (item)
}
function hitTestCheck ()
{
var aLength = AArray.length
var bLength = BArray.length
for (var i:uint; i<aLength; ++i)
{
for (var p:uint; p<bLength; ++p)
{
if (AArray[i].hitTestObject(BArray[p]))
{
hitTestFunction ()
}
}
}
}
as me specific bits if you dont understand
At 1/13/10 01:19 PM, Yambanshee wrote: function hitTestCheck ()
{
var aLength = AArray.length
var bLength = BArray.length
for (var i:uint; i<aLength; ++i)
{
for (var p:uint; p<bLength; ++p)
{
if (AArray[i].hitTestObject(BArray[p]))
{
hitTestFunction ()
}
}
}
}
as me specific bits if you dont understand
Whoa whats up with the formating on that script ? theres blank lines everywhere
nobody
At 1/13/10 01:41 PM, hdxmike wrote: Whoa whats up with the formating on that script ? theres blank lines everywhere
written in the bbs
and i like spacing my things out :]
At 1/13/10 01:59 PM, Yambanshee wrote:At 1/13/10 01:41 PM, hdxmike wrote: Whoa whats up with the formating on that script ? theres blank lines everywherewritten in the bbs
and i like spacing my things out :]
Suit yourself , i like to cuddle my code with curly braces so theyll grow up loving and warm
nobody