What type of object are landingColor and spaceColor?
Explain the meaning of: "private double gravity = 1.6" ?What is its purpose?
Extension:
What is a thread?
What does the Lander constructor do?
What is the role of addedToWorld?
What effect does the key press have on the progress of the Lander?
Where is the applyGravity function kept? What effect does it have on the Lander?
What is the y position of the Lander at the start of the simulation?
How is the altitude of the Lander changed?
How does the program decide if the Lander has landed successfully on the landing platform?
How does the program decide if the Lander has crashed and an explosion should occur?
What happens if the Lander crashes?
When and how is the flag displayed at the landing site? How is the flag created and displayed?
The LunarLander introduces the Explosion class. You could copy this code and add it to other programs. There is another version of the explosion on the Helper class page.
How many images are used in an explosion?
Summarise the way that images are used to create an explosion.
What is the meaning of the word 'synchronized' in the function heading of initialiseImages() ?
What does initialiseImages() do?
What does the act() function do?
Explain what the explodeOthers() function does.
Create a new scenario. Add a background to the World. Add an Actor class with an image such as a balloon. Create a new class called 'Explosion' and copy the code from the Explosion class in LunarLander into this new class. Run the program and add a balloon and then add a new explosion close to it: the balloon should be destroyed by the explosion.
You will need to make sure that the image and sound files are present: explosion.png and Explosion.wav.
Change the code so that the explosion does not destroy the balloon.
Try limiting the size or extent of an explosion. What do you need to change?
Develop the Asteroids game. Add an explosion of an appropriate size when you hit a falling object. The scenario already includes the Explosion class. You could now remove the bombs from this game.
This is continued from the Wombats page. Use the Creating movement video to help you with this exercise.
Create a new actor class called 'mover'. Fetch the Mover class from the Helper Classes page and compile it. Change the signature of the Bug class to "extends mover" so that 'mover' is a 'superclass' for 'bug' and bug inherits the methods of the mover class. Click Compile all to implement the change (Bug should now be a subclass of mover).
List the methods now available to the bug class from the mover superclass. Which methods can you now replace?
Make the bug turn when it reaches the edge of the world.
Make the bug turn under the control of key presses such as up, down, left and right.
Extension:
What is the Greenfoot class? Give three examples of methods that it makes available to Greenfoot programs.
What is a class? What is an object? What is a superclass?
This is continued from the Wombats page. Use the Initialising the world video to help you with this exercise.
Add a second class that moves around the screen at random. Have the bugs chase members of this second class and remove them when they collide. Have a points score to measure success. Have new food objects created as the game is played.
This is based on the BugWorld scenario developed at the end of Wombats.
Add up and down key presses.
Using a suitable grid of cells design a maze and steer the bug around it. Add food and points to the scenario. Add enemies that walk around the maze and kill the bug if they collide.
Extension: Design your own maze in a graphics program such as Photoshop so that it fits into the dimensions of the existing maze and the barriers and channels match the dimensions of the