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
- statusBall=0;
- function kicking(){
- if (Key.isDown(Key.ENTER)) {
- Human2_mc.gotoAndPlay(2);
- }
- }
- function cekBallStatus(){
- if (Human2_mc.dot_mc.hitTest(ball_mc)){
- statusBall=1;
- }
- }
- ball_mc.onEnterFrame=function(){
- kicking();
- cekBallStatus();
- if (statusBall==1){
- ball_mc._x+=5;
- ball_mc._y-=2
- ball_mc._rotation+=10;
- }
- if ( ball_mc._x>=331){
- statusBall=2;
- ball_mc._x=135;
- ball_mc._y=215;
- }
- }
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