|
|
|
Creating a fishing game using actionscript
Author: imtiazur rahman | Email Website : www.flashorama.tk
Advertisement
Start Page 6
4.3 Coding...continued:
in the fishing gears, there are two important parts. one is the hook. this will go up & down with the arrow keys. make the name of the hook as "hook" in the instance name box.
now the other part is "rope". it will be longer & shorter with the arrow keys. now in the rope movieClip, add this code:
onClipEvent (enterFrame) {
if(Key.isDown(Key.DOWN)) {
this._yscale+=100;
_root.hook._y+=8.6;
} if (Key.isDown(Key.UP)) {
this._yscale-=100;
_root.hook._y-=8.6;
} if (this._y < 272) {
this._y = 272;
_root.hook._y = 282;
}
}
here when the down key is pressed, the rope gets long & shorter when up key is pressed. pretty simple.
now we will add a timer. its a separate movieClip where after 1 minute the game will be over. at the last frame of the movieClip this code is added:
_parent.gotoAndPlay("gameOver", 1);
so after a minute, we will be at the "gameOver" scene where the scores are shown. ok main part of game finito!
Download Source File
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section
Submit your Tutorial at Click Here
|
|
|