Hit side detection.
Is there a way to determine which side of the object was hit top, left, right, bottom ?
I don't wanna to overlap each other the objects.Also I wanna keep the objects in stage limit.The buttons must move away when hit each other.
How do I move the object to reverse direction when hit each other ?? for example: Fish 2 hit below or top from to fish 3,then fish 2 go y.if Fish 2 hit to fish 3 from left or right side then fish 2 go x.How can I do that ?
I add red rule for hit but buttons moving like a stuck.Also I tried hitTestObject but move stuck again.I have 7 object on the stage.
I use this code move for sample object.
var fish2x:Number=8;
var fish2y:Number=8;
stage.addEventListener(Event.ENTER_FRAME,h42);
function h42(s:Event) {
fish2.x+=fish2x;
fish2.y+=fish2y;
if ((fish2.x>=stage.stageWidth-fish2.width/2)|| (fish2.x <= fish2.width/2 || (fish2.x <=fish3.y/2))) {
fish2x*=-1;
}
if ((fish2.y>=stage.stageHeight-fish2.height/2)|| (fish2.y <= fish2.height/2 )) {
fish2y*=-1;
}

