I am trying to get a simple game working in flash and the last thing I can't figure out my error at the end of my code if you could solve it thanks
I am trying to test if the object from the library fl_MyInstance_5 hits player1 but I get the error (not in normal error log but when I enter the scene while actually testing the game)
import flash.events.TouchEvent
import flash.events.PressAndTapGestureEvent
player1.x = 320 //Centers Player
var grav: Number = 10; //Jumping Mechanism
var jumping: Boolean = false;
var jumpPow: Number = 0;
stage.addEventListener(TouchEvent.TOUCH_TAP, onKeyDown) //Jumping Touch Sensor
stage.addEventListener(Event.ENTER_FRAME, update);
function onKeyDown(evt: TouchEvent): void { //Jumping Mechanism
if (flash.events.TouchEvent) {
if (jumping != true) {
jumpPow = -70; //Change "Hight" Of the Jump (Power)
jumping = true;
}
}
}
function update(evt: Event): void {
if (jumping) {
player1.y += jumpPow;
jumpPow += grav;
if (player1.y >= stage.stageHeight) {
jumping = false;
player1.y = stage.stageHeight;
}
}
}
//E_g Enemy
var fl_MyInstance_5: LibrarySymbol = new LibrarySymbol();
addChild(fl_MyInstance_5);
fl_MyInstance_5.x = 700 //fl_MyInstance_5 = Green Enemy
fl_MyInstance_5.y = 900
fl_MyInstance_5.addEventListener(Event.ENTER_FRAME, fl_AnimateHorizontally);
function fl_AnimateHorizontally(event: Event) {
fl_MyInstance_5.x += -10;
}
fl_MyInstance_5.addEventListener(Event.ENTER_FRAME, fl_RotateContinuously);
function fl_RotateContinuously(event: Event) {
fl_MyInstance_5.rotation += -10;
}
if (fl_MyInstance_5.hitTest(player1)) {
removeChild(fl_MyInstance_5);
}I am trying to test if the object from the library fl_MyInstance_5 hits player1 but I get the error (not in normal error log but when I enter the scene while actually testing the game)
