7. Extension Ideas
This concludes the tutorial for a simple Greenfoot game!
Try a combination of the suggestions below to add complexity to your game:
1. Make a New Class for 'Bad' Collectibles
Create a new subclass in the Actor classes section for a new collectible that will lower the score if picked up.
Add code to your main character to remove the collectible when they touch.
Add code to decrease the counter by 1 at the same time.
2. Make the Collectibles Move Randomly
Copy the code from your enemy class that makes it move randomly and bounce on edge, and paste this into your collectible class.
This makes it harder to catch the collectables, especially if there are 'bad' objects to avoid.
3. Stop the Game
Go to the code of your enemy and add the line underlined in red within your removal code.
This will stop the game if your main character is eaten.
4. Make the Game Multiplayer
Create a new subclass in the Actor classes section for a new main character that will be controlled by a second player.
Add code to your new character to move it right, down, left and up.
Choose different keys for each direction, such as the WASD keys or IJKL keys.
If the second player touches a collectible, add code to decrease the score.
Player 1 wins if the final score is above 0.
Player 2 wins if the final score is negative.
It is a draw if it finishes on 0.