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 5

4.2 Coding...continued:

now we will put the scoring system. lets add a layer named "score". here we will put a dynamic textbox. in the variable box (lower right at properties) put the name "score". this will be the scoreboard for us(i hope!)

lets go back to the fish & sharks. double click the fish movie clip. here is the fish animation. ok, make it another movieclip. now in the movieClip, make the 2nd frame into a keyFrame. assign a code in the first frame:


stop();


in the 2nd keyframe, delete the fish animation & add frames till 20. i have kept the framerate as 10 fps.

in the first frame, click the fish movieClip & open Action panel. add this code here:


onClipEvent (enterFrame) {
if (this.hitTest(_root.hook)) {
_root.score= _root.score + 10;
_parent.play ();
}
}



what is "hook"? good question. it will be the hook of the fishing stick we will make later. so in this code we see that whenever we hit the hook of the fisherman, 10 number is added in the scoreboard. hooray!

wait, what does _parent.play(); mean? another good question. well, we do not want the fish to be seen after we catch it. so we made the code so that the fish "disaoppears" after catching. clever huh?

we will do the same thing with the shark movieclip, but the code assigning inside the shark is like this:


onClipEvent (enterFrame) {
if (this.hitTest(_root.hook)) {
_root.score= _root.score - 10;
_parent.play();
}
}


whats the difference? well, when the hook hits the fish 10 numbers add, & when it hits the shark 10 numbers are deducted. so the user will try to catch the fishes only, not the sharks because it will lower his scores.

now time to start talking about fishing gears & times.

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.

2 users online