Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here










 

Google

Search WWW   
FlashAdvisor.com

 Home > Tutorials  > Gaming

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

| 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Rate This Tutorial :
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
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

35 users online