Okay, I’m trying to make a game to help myself learn flash, it is a pseudo 1st person shooter where enemies attack you, and you shoot them. Currently I have a function for shooting at the stage/baddies using the code below. This has two problems, one, when I click somewhere it fires their, but when I click a second time, it fires at 0,0 coordinates on the screen, then if I move the mouse and fire, it doesn’t track accurately. I’m just learning so I’m probably making several dumb mistakes, guidance would be appreciated.
package{
import flash.display.*;
import flash.events.*;
public class Gungame{
public var bulArray:Array = new Array();
public function Gungame(){
stage.addEventListener(MouseEvent.MOUSE_DOWN, fire)
}
public function fire(){
for(var i:int = 0; i<1; i++){
bulArray.push(new Bullet());
var s:Bullet = bulArray*;
s.locations;
addChild(s);
}
}
}
}
Bullet Class
package{
import flash.display.*;
import flash.events.*;
public class Bullet extends MovieClip{
public function Bullet(){
trace('I am working');
}
public function locations(){
this.x = mouseX;
this.y = mouseY;
}
}
}