

- #Greenfoot game code update#
- #Greenfoot game code code#
- #Greenfoot game code series#
- #Greenfoot game code free#
#Greenfoot game code code#
It also requires me to add code in the Hero’s class so it can gather a Satellite. The last item is to initialize the World and spawn the satellites for the game. Alien – updated java source code (has explode method).YouTube – Updating the Laser class and Making an Explosion.When it does that I would like an explosion to animate one time and then remove itself… Below I will show you the basic idea but your job is to make the explosion happen in your game (or use at least one animation). In this game I would like it to take Aliens out of the World. YouTube – creating the MotherShip class.You can have your enemies added to the world by another means but I thought this character might give you some inspiration for your own ideas. This is a feature I added, a mothership that spawns the UFOs (my villains). If an alien touched the Hero, the Hero is removed from the game and the scenario stops (game over). This is one of the dangers to my main character (Hero). YouTube – creating the GoalMover/Location classes.
#Greenfoot game code free#
Feel free to subclass it and add new/different features though. You should just use the class, at this stage you are not responsible for reproducing your own GoalMover type class. This is a utility class that you can use to do that. One thing you may want to program your villains to do it move towards a goal.
#Greenfoot game code update#
You can define your own hero using some of these features but yours must keep track of its score so that you can update it on your ScoreBoard. This is my human player, a space ship that is controlled by both the keyboard and the mouse. Then subclass your weapons from this Projectile class. Start by defining a class called Projectile that is based on my Laser. Feel free to use my class as a start but since you are creating more than one you should build a hierarchy to reuse your code. You will have to create two different weapons (or more) that can be fired with different keys. This is a Laser but could be any kind of projectile you like.

You do not need to create your own Label class, please use mine. This is a utility that you may find useful. If you want to work with a partner, you could each make a level with different enemies and targets to gather. You must also include sound effects in your final code. You could do your scenario in the Ocean with Sharks and Dolphins, or in the Forest with Bears, Hunters, and Fish, … it does not have to be set in outer space. In my scenario the human player collects satellites and the game is over after 10 are found. The final requirement is to have a goal for the human player, one which it can complete in order to complete the game or move on to the next level. The danger it poses is by spawning UFOs that can attack you. You must also have a villain that poses some danger to you. The requirements for the project are described below but the overall game you create should have a human player that is controlled by the keyboard and/or mouse.
#Greenfoot game code series#
To make your first game in Greenfoot you will create a game similar to the one I will walk you through in the series of videos below.
