Collision with an object replacing the mouse
Hi,
I am a beginner to Actionscript 3
I am creating a simple game (for practice purpose)
here is my code:
Code:
stop();
var lvl1:MovieClip = new Linelvl1();
lvl1.x = 400;
lvl1.y = 240;
addChild(lvl1);
lvl1.alpha = 0;
var mouse:MovieClip = new Ball();
mouse.x = 400;
mouse.y = 240;
addChild(mouse);
addEventListener(Event.ENTER_FRAME, onStart);
function onStart(evt:Event) {
if (lvl1.hitTestPoint(mouseX, mouseY, true)) {
removeEventListener(Event.ENTER_FRAME, onStart);
removeChild(lvl1);
gotoAndStop("main");
}
}
mouse.x = mouseX;
mouse.y = mouseY;
Mouse.hide();
}
So now, my question is this.
As you've noticed I created a "Ball" that replaces the mouse and I've hid the mouse. Whenever the mouse or the "Ball" touches "lvl1" I want it to go to "main". But it doesn't work
I even changed hitTestPoint to hitTestObject but....I don't know why it doesn't work
Any help...?