Monday, May 5, 2008

Tutorial 3 - Supplementary - Problem 2


Problem 2: Given a scenario with a castle, girl, wizard, and dragon where the Dragon is attacking the Castle. You finish the scenario where the dragon attacks the wizard, wizard fights back, and kills the dragon.
You have to create the following methods:

  • (a) A class-level method for dragon, called MoveNFlap, that moves the dragon forward 4 meters and flaps its wings at the same tiem. Then, call this method 2 times from my first world method.

  • (b) A class-level method for dragon, called CircleObject, to circle around any object (i.e. a parameter). Then, call this method from my first world method to circle around the wizard. (Hint: use asSeenby)

  • (c) A class-level method for wizard, called Teleport, to allow the wizard to teleport to behind the dragon. This means, turn to face dragon, become invisible, move to behind the dragon, and become visible again. Then, call this method from my first world method.

  • (d)) A world-level method, called KillDragon, where the wizard says his magic words again and the dragon disappears.