Okay, I'm using CS3, and I'm trying to make a turn based fight engine. So i have 3 frames, on the first one i have it setting the enemy hp and the player hp. Then on the next frame i have it setting the attack type button invisible and the attack button visible. On the frame i have my enemy and the player, and the attack button. The actions on the attack button are telling it to make the attack options visible on release. Then on the attack option i have it telling the player MC to go to the frame that corresponds to the attack type. After the player attack, it goes to the 3rd frame, which is the enemy's turn. On the frame i have it making a variable with a random value between 0 and 1. On the enemy MC i have it telling it to this.gotoAndPlay("punch"); if the random value is 0, and this.gotoAndPlay("kick"); if the random value is 1. On the enemy i have the frames named "punch" and "kick". The problem is that it doesnt work.
TL;DR. On a frame i have the code
stop();
_root.enematk = random(1);
And on my MC i have
onClipEvent (enterFrame) {
if(_root.enematk == 0){
this.gotoAndPlay("punch");
}
if(_root.enematk == 1){
this.gotoAndPlay("kick");
}
}
Inside my MC i have frames named "punch" and "kick". It just doesnt work though. If i replace the names with the numbers, it still doesnt work. If i replace "gotoAndPlay();" with "play();" it works, but it can only do one attack. Help?