Showing posts with label Applets. Show all posts
Showing posts with label Applets. Show all posts

Thursday, July 23, 2009

Redware's Fish-2.0 Game - Shortly Explained

This game consists of 8 sprites (1 shark-sprite, 6 yellow-fish-sprite, 1 red-fish-sprite). But if we look at the script blocks, we just have to focus on two things: the script blocks for the shark-sprite and the other blocks for the yellow and red-fish sprites (see picture below). Note that (1) only the shark-sprite has more than one costume; (2) all yellow-fish sprites and red-fish sprite have similar behaviour (except that in the event "touching shark" red-fish sprite broadcast a different message than its yellow friends).



For original script description, you should refer to Redware's website. Here I just want to shortly explain & summarize the script blocks above.

Shark Sprite:
  • If the green flag is clicked, "score" variable is set to 0; the shark will begin its exploration by following mouse-pointer

  • If the shark receive "sharktouchingyellowfish" message, it will animate 3 times before it looks normal again

  • If the shark receive "sharktouchingredfish" message, the score will be reset to 0 and the shark will take another (sad-looking) costume for a while

Other Fish Sprites:
  • If the green flag is clicked, each sprite will sense if it has been eaten by the shark (i.e. touching shark); if not, it just randomly take a direction and move forward

  • If a fish meets the shark, it broadcasts the "sharktouchingXXfish" message and hides for a while but appears again from a random position at the left or right side; in this case the score is incremented

Monday, July 20, 2009

Redware's Fish-2.0 Game

I just want to try embedding remote Java applets from inside Blogger/Blogspot. It seems to work, right? *Unfortunately applets can not be resized with plain HTML codes; and my current template is too small for it ... so here I'll go with an image and direct link to Scratch project page*

Scratch Project


I think this simple game is quite interesting and should be addressed in more details ... well o.k. maybe next time :-D. Now, according to the author (Redware), this can be built from scratch (of course using Scratch :-D ) in following simple stages:
  1. Create the shark sprite and control movement with the mouse

  2. Create the yellow fish sprite with random movement

  3. Add a variable to keep the score

  4. Get the yellowfish sprite to broadcase a message if it is eaten by the shark

  5. Add shark behaviour that receives a message when a yellowfish is eaten and animates the shark to look like it is feeding

  6. Make the yellow fish disappear when it is eaten and then reappear a few seconds later

  7. Duplicate the yellowfish sprite so that there are several fish in the game

  8. Add a red fish and more broadcast and receive behaviour for the shark to get indigestion