Hello I' am trying to make two collison walls in the form of two lines which I have given the instance name 'colission1' and 'colission2' I have used the following code to make the cars dissapear and the gameover message to pop up when they are git by the car;
addEventListener(Event.ENTER_FRAME, hit1);
function hit1(e:Event):void {
if (car_mc.hitTestObject(colission2_mc))
{
gotoAndPlay(2);
gotoAndStop(2);
car_mc.visible = false;
stop();
}
else
{
car_mc.visible = true;
}
}
addEventListener(Event.ENTER_FRAME, hit2);
function hit2(e:Event):void {
if (car_mc.hitTestObject(colission1_mc))
{
gotoAndPlay(2);
gotoAndStop(2);
car_mc.visible = false;
stop();
}
else
{
car_mc.visible = true;
}
}
and then I get this error;
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at Gamev1_fla::MainTimeline/hit1()
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at Gamev1_fla::MainTimeline/hit2()