You can do this using a method from the rocket’s object menu. Play again (with at least two asteroids) to try it out.įrom Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 1.11 Once you have managed to remove all asteroids (or at any other point in the game), stop the execution (press Pause) and find out how many shots you have fired. (This should make getting the asteroids a bit easier!) Place a rocket into the world, and then invoke its setGunReloadTime method (through the object menu), and set the reload time to 5. Let us tweak our spaceship firing software a bit so that we can shoot a bit quicker. Vector is a helper class used by other classes From Introduction to Programming with Greenfoot by Michael Kölling Used with permissionįrom Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 1.10 If you have played this game for a while, you will have noticed that you cannot fire very quickly.Asteroid, Bullet and Rocket are subclasses of Mover.Explosion and Mover are subclasses of Actor.Space is a specific Greenfoot World - a subclass of World.Space represents specific world for the scenario.What does this do?įrom Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 1.8 What is the difference between clicking the Act button and invoking the act() method? (Try with several wombats in the world.) Exercise 1.9 Click the Run button. Exercise 1.7 Still with a wombat and some leaves in the world, click the Act button in the execution controls near the bottom of the Greenfoot window. What does this method do? How does it differ from the move method? Make sure to try different situations, for example, the wombat facing the edge of a world, or sitting on a leaf. What happens when you type a number greater than 3? What happens if you provide input that is not a whole number, such as a decimal number (2.5) or a word (three)?įrom Introduction to Programming with Greenfoot by Michael Kölling Used with permission Exercise 1.6 Place a wombat and a good number of leaves into the world, and then invoke a wombat’s act() method several times. ![]() Which number corresponds to which direction? Write them down. Provide a parameter value and see what happens.
0 Comments
Leave a Reply. |