we can make a simple action characters that can happen to be a reaction if there is action from the characters by using Macromedia Flash and Actionscript, previously only a continuation of build a Basic Character from the last page



in the image above shows the two main objects of the man with the initials Human2_mc and a ball with the initials ball_mc on a movieclip, where the ball will move upwards if the character kicking the ball, on the main page there is one frame and the movie with frame script for action following

  1. statusBall=0;
  2. function kicking(){
  3.          if (Key.isDown(Key.ENTER)) {
  4.               Human2_mc.gotoAndPlay(2);
  5.              }
  6.     }
  7. function cekBallStatus(){
  8.        if (Human2_mc.dot_mc.hitTest(ball_mc)){
  9.           statusBall=1;
  10.          }
  11. }
  12. ball_mc.onEnterFrame=function(){
  13.       kicking();
  14.      cekBallStatus();
  15.      if (statusBall==1){
  16.         ball_mc._x+=5;
  17.         ball_mc._y-=2
  18.         ball_mc._rotation+=10;
  19.        }
  20.     if ( ball_mc._x>=331){
  21.        statusBall=2;
  22.        ball_mc._x=135;
  23.        ball_mc._y=215;
  24.      }
for Human2_mc there are several objects in some frames that will be explained in the picture below

hitTest function as a detector junction between the dot_mc movie movieclip Human2_mc with ball_mc. click here for download example

No comments:

Post a Comment