I'm trying to have the hero fire a bullet from his gun. Here's what I have so far, but at the moment it's not working.
Could someone please give me so help?
Thanks.
Here's the function:
Code:
function addBullet():Void {
if (bullet_array.length>=numBullets) {
var tempBullet_mc:MovieClip = this.attachMovie("bullet_id", "bullet"+bullet_array.length+"_mc", this.getNextHighestDepth());
this.tempBullet_mc._x = this.hero_mc.arm_mc.gun_mc._x;
this.tempBullet_mc._y = this.hero_mc.arm_mc.gun_mc._y;
}
}
Here's the function call:
Code:
this.onMouseUp = function():Void {
addBullet();
};
Here are the variables:
Code:
var bullet_array:Array = new Array();
var numBullets:Number = 6;