I am trying to test if the bullet defined in the .as file is touching the player defined in the .fla file.
I have this if statement in my .fla file
if (spaceBarPressed == true) {
var eb = new EnemyBullet(player)
stage.addChild(eb)
eb.x = enemy.x + 120
eb.y = enemy.y + 120
}
and this in my .as file
public function EnemyBullet(player) {
addEventListener(Event.ENTER_FRAME, update)
if (this.hitTestObject(player)) {
trace("hit")
}
}
function update(event:Event) {
this.x+=5
}
But I can't seem to get it to work.