Advertisement
Guest User

random attacks

a guest
May 27th, 2015
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //the frames you have need labels (without quotes, of course)
  2. //in this case i use enemyAttackN where N can be 1, 2 or 3
  3. on(release) {
  4.     var rand = Math.floor(Math.random() * 3 + 1);
  5.     if(rand == 1) {
  6.         gotoAndPlay("enemyAttack1");
  7.     } else if(rand == 2) {
  8.         gotoAndPlay("enemyAttack2");
  9.     } else if(rand == 3) {
  10.         gotoAndPlay("enemyAttack2");
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement