My code is not working, and I am not sure why.
package {
import flash.display.MovieClip;
import flash.events.Event;
public class enemys extends MovieClip {
public var playz:Circles
public function enemys() {
stage.addEventListener(Event.ENTER_FRAME, hittrue)
stage.addEventListener(Event.ENTER_FRAME, moving)
}
public function hittrue(event:Event) {
if (this.hitTestObject(playz)) {
while (numChildren > 0) {
removeChildAt(0)
}
gotoAndStop(2)
}
}
}
It has to do with the variable playz: it says it is null yet I defined it in the variable section.