How can I detect the collision with hitTestPoint ?
I have a car game which is drive reverse.The game over when enemy and car hit each other.I have problem with collision. Car and enemy hit when they get close each other,but they have still big space in there.
Please check this image. https://s8.postimg.cc/p85w0wm2t/image.gif
Than somebody tell me I need to use "localToGlobal " So i do, i have a collision now,but it does when only contact to center of the object.Than said "You need to form a list (an Array) of border points and hit test all of them against the other object." But i can't figure out how.How can i do that ?
var aPoint:Point = new Point();
aPoint = carMC.localToGlobal(aPoint);
var bPoint:Point = new Point();
bPoint = dubageri1.localToGlobal(bPoint);
var bir:Number=92;
var iki:Number=186;
var uc:Number=40;
var dort:Number=68;
var rakamlarlev8:Array=new Array("bir","iki","uc","dort");
stage.addEventListener(Event.ENTER_FRAME,ilkcikis);
function ilkcikis(event:Event) {
var zHit:Boolean = carMC.hitTestPoint(bPoint.x, bPoint.y, true);
textbaba.text = zHit? "! HIT !": "NO HIT";
trace(clickPoint);
carMC.x=mouseX;
carMC.y=mouseY;
}