header ads

Banana And Monkey Game Action Script 3.0

Hey everyone! Here’s a super brief tutorial. The Banana and Monkey  Game have been Made For Kids Education. Let's Learn Step By Step How to Make it.

Step 1: Creating a new document Flash ActionScript 3.0
Document Width:- 1280px Height:- 720px and Frame Rate:- 24fps.
Step 2: Downloading the asset of the game

Click And Download All Asset.  After Downloading Asset Copy All Layer in your document and Changing Some in Design Layout to make your own game.

Step 3: Final Step 


Copy and paste this code on the second frame.








var boxes: Array = new(Array);
var box: box1 = new(box1);
var dropSpeed = 5;
var playerSpeed = 10;
var lable: Number = 0;
var speed: Number = 5;
var gameOn: Boolean = true;
var math: Number = 3000;
var question: Number = 0;
var Score: int;
var question_mc: Number = 0;





mcGame.mcGameField.mcMonkey.gotoAndStop("Grab");

var interval = setInterval(dropBox, math)




//addEventListener(Event.ENTER_FRAME, dropBox);

function dropBox(): void {
 if (gameOn == true) {



  if (Score > 1) {
   var math2 = 2000;
   dropSpeed = 6;
   clearInterval(interval);
   interval = setInterval(dropBox, math2)
  }




  if (Score > 10) {
   var math3 = 1000;
   dropSpeed = 7;
   clearInterval(interval);
   interval = setInterval(dropBox, math3)
  }







  box = new(box1);

  box.x = Math.floor(Math.random() * tar2.width) / 100 + tar2.width;
  box.y = -110;
  addChild(box);
  boxes.push(box);


  var showBox = int(Math.random() * box.totalFrames) - 1;

  box.gotoAndStop(showBox);


  if (box.currentLabel == "A") {
   box.type = "A";
  }
  if (box.currentLabel == "B") {
   box.type = "B";
  }

  if (box.currentLabel == "C") {
   box.type = "C";
  }
  if (box.currentLabel == "D") {
   box.type = "D";
  }
  if (box.currentLabel == "E") {
   box.type = "E";
  }
  if (box.currentLabel == "F") {
   box.type = "F";
  }
  if (box.currentLabel == "G") {
   box.type = "G";
  }
  if (box.currentLabel == "H") {
   box.type = "H";
  }
  if (box.currentLabel == "I") {
   box.type = "I";
  }
  if (box.currentLabel == "J") {
   box.type = "J";
  }
  if (box.currentLabel == "K") {
   box.type = "K";
  }
  if (box.currentLabel == "L") {
   box.type = "L";
  }
  if (box.currentLabel == "M") {
   box.type = "M";
  }
  if (box.currentLabel == "N") {
   box.type = "N";
  }
  if (box.currentLabel == "O") {
   box.type = "O";
  }
  if (box.currentLabel == "P") {
   box.type = "P";
  }
  if (box.currentLabel == "P") {
   box.type = "P";
  }
  if (box.currentLabel == "P") {
   box.type = "P";
  }

  if (box.currentLabel == "P") {
   box.type = "P";
  }

  if (box.currentLabel == "Q") {
   box.type = "Q";
  }

  if (box.currentLabel == "R") {
   box.type = "R";
  }

  if (box.currentLabel == "S") {
   box.type = "S";
  }

  if (box.currentLabel == "T") {
   box.type = "T";
  }

  if (box.currentLabel == "U") {
   box.type = "U";
  }

  if (box.currentLabel == "V") {
   box.type = "V";
  }

  if (box.currentLabel == "W") {
   box.type = "W";
  }

  if (box.currentLabel == "X") {
   box.type = "X";
  }

  if (box.currentLabel == "Y") {
   box.type = "Y";
  }

  if (box.currentLabel == "Z") {
   box.type = "Z";
  }


  /*if(box.currentLabel == "Health")
  {
  box.type = "Health";
  }*/
 }

}


var A: Boolean;
var B: Boolean;
var C: Boolean;

var D: Boolean;

var E: Boolean;

var F: Boolean;

var G: Boolean;

var H: Boolean;

var I: Boolean;

var J: Boolean;

var K: Boolean;

var L: Boolean;

var M: Boolean;

var N: Boolean;

var O: Boolean;

var P: Boolean;

var Q: Boolean;

var R: Boolean;

var S: Boolean;

var T: Boolean;

var U: Boolean;

var V: Boolean;

var W: Boolean;

var X: Boolean;

var Y: Boolean;

var Z: Boolean;


stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPresse);
stage.addEventListener(KeyboardEvent.KEY_UP, keyRelease);

function keyPresse(e: KeyboardEvent): void {

 var key: uint = e.keyCode;

 if (key == 65) {
  A = true;
  trace("A :-", A);
 }
 if (key == 66) {
  B = true;
 }
 if (key == 67) {
  C = true;
 }
 if (key == 68) {
  D = true;
 }
 if (key == 69) {
  E = true;
 }
 if (key == 70) {
  F = true;
 }
 if (key == 71) {
  G = true;
 }
 if (key == 72) {
  H = true;
 }
 if (key == 73) {
  I = true;
 }
 if (key == 74) {
  J = true;
 }
 if (key == 75) {
  K = true;
 }
 if (key == 76) {
  L = true;
 }
 if (key == 77) {
  M = true;
 }
 if (key == 78) {
  N = true;
 }
 if (key == 79) {
  O = true;
 }
 if (key == 80) {
  P = true;
 }

 if (key == 81) {
  Q = true;
 }
 if (key == 82) {
  R = true;
 }
 if (key == 83) {
  S = true;
 }
 if (key == 84) {
  T = true;
 }
 if (key == 85) {
  U = true;
 }
 if (key == 86) {
  V = true;
 }
 if (key == 87) {
  W = true;
 }
 if (key == 88) {
  X = true;
 }
 if (key == 89) {
  Y = true;
 }
 if (key == 90) {
  Z = true;
 }



}


function keyRelease(e: KeyboardEvent): void {

 var key: uint = e.keyCode;


 if (key == 65) {
  A = false;
  trace("A :- ", A);
 }
 if (key == 66) {
  B = false;
 }
 if (key == 67) {
  C = false;
 }
 if (key == 68) {
  D = false;
 }
 if (key == 69) {
  E = false;
 }
 if (key == 70) {
  F = false;
 }
 if (key == 71) {
  G = false;
 }
 if (key == 72) {
  H = false;
 }
 if (key == 73) {
  I = false;
 }
 if (key == 74) {
  J = false;
 }
 if (key == 75) {
  K = false;
 }
 if (key == 76) {
  L = false;
 }
 if (key == 77) {
  M = false;
 }
 if (key == 78) {
  N = false;
 }
 if (key == 79) {
  O = false;
 }
 if (key == 80) {
  P = false;
 }

 if (key == 81) {
  Q = false;
 }
 if (key == 82) {
  R = false;
 }
 if (key == 83) {
  S = false;
 }
 if (key == 84) {
  T = false;
 }
 if (key == 85) {
  U = false;
 }
 if (key == 86) {
  V = false;
 }
 if (key == 87) {
  W = false;
 }
 if (key == 88) {
  X = false;
 }
 if (key == 89) {
  Y = false;
 }
 if (key == 90) {
  Z = false;
 }


}





var sound2sound: tui = new tui();
var mychannel2: SoundChannel = sound2sound.play();
mychannel2.stop();

var sound3: fat = new fat();
var mychannel_3: SoundChannel = sound3.play();
mychannel_3.stop();



addEventListener(Event.ENTER_FRAME, movebox);

function movebox(e: Event): void {

 for (var i = 0; i < boxes.length; i++) {
  boxes[i].y += dropSpeed;


  if (lable == 3) {

   lable = 0;
   dropSpeed = 0;
   gameOn = false;

  }


  if (boxes[i].hitTestObject(tar4)) {

   tar2.gotoAndStop(2);
   //trace("Hit");



   if (boxes[i].type == "A") {
    if (A) {



     if (lable == 3) {

      lable = 0;
      dropSpeed = 0;
      gameOn = false;

     } else {

      lable++;
      Score++;
      Score_txt.text = Score.toString();
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);

     }


     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "B") {
    if (B) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);

     }
     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "C") {
    if (C) {
     if (lable == 3) {

      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "C") {
    if (C) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "D") {
    if (D) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "E") {
    if (E) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "F") {
    if (F) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "G") {
    if (G) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "H") {
    if (H) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "I") {
    if (I) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "J") {
    if (J) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "K") {
    if (K) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "L") {
    if (L) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "M") {
    if (M) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "N") {
    if (N) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "O") {
    if (O) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }



   } else if (boxes[i].type == "P") {
    if (P) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }


   } else if (boxes[i].type == "Q") {
    if (Q) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "R") {
    if (R) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "S") {
    if (S) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "T") {
    if (T) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "U") {
    if (U) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "V") {
    if (V) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "W") {
    if (W) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "X") {
    if (X) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "Y") {
    if (Y) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   } else if (boxes[i].type == "Z") {
    if (Z) {
     if (lable == 3) {
      lable = 0;
      dropSpeed = 0;
      gameOn = false;
     } else {
      lable++;
      Score++;
      Score_txt.text = Score.toString();
      sound2sound.play();
      mcGame.mcGameField.mcMonkey.gotoAndStop("Bite" + lable);
     }

     //removeEventListener(Event.ENTER_FRAME, movebox);
     //gameOn = false;
     removeChild(boxes[i]);
     boxes.splice(i, 1);
    }

   }







  } else {
   tar2.gotoAndStop(1);


  }


  if (boxes[i].hitTestObject(tar3)) {
   sound3.play();
   removeChild(boxes[i]);
   boxes.splice(i, 1);
  }






 }







}







I made this game in 7 days. if you want to learn Actionscript 3.0 and game development. connect with me. I have made a game on play store for kids.


Rated My Work

Kids Coloring

https://play.google.com/store/apps/details?id=air.com.Myapp.KidsColoring



Post a Comment

0 Comments