actionscript
yeah I really suck at this.
I have to make an "interactive" animation for my current project at uni. Im fine with the animating part but I suck at actionscript, and thought I may as well try and learn some more and get more out of the project.
Anyway i decided to add a little "first person shooter" bit to the animation. you cant move or walk around or anything, you just click the enemies and they die. Im stuck though. Ive got it working so the gun follows the mouse, theres a timer etc, but there are some problems.
You can only kill an enemy if you click on him. So you cant hold down shoot and drag it accross him.
I tried to fix this using this, but it doesnt work:
onMouseDown = function () {
shooting = true;
gun.gotoAndStop(2);
}
onMouseUp = function () {
shooting = false;
gun.gotoAndStop(1);
};
if(shooting = true){
enemy.onPress = function(){
kill(enemy1)
}
enemy2.onPress = function(){
kill(enemy2)}
};
Im also trying to make it so you can only "kill" an enemy once. So at the moment the "kill" functon runs:
function kill(enemyname) {
enemyname.gotoAndPlay(2);
kills += 1;
}
But you can just click each enemy more than once and get the kill count. Whats the best way of detecting when a enemy is dead, apart from creating a boolean and function for EVERY enemy?
I know im using noob actionscript and i suck, im just learning :3