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

No comments:

Post a Comment