Each time they get hit by a bullet, their stability decreases. What is its initial speed?ġ4 Exercise 4 Asteroids have an inherent stability. Invoke a Rocket method.ġ3 Exercise 3 You will notice that the rocket moves a bit as soon as you place it into the World. Then play again.ġ2 Exercise 2 Stop the execution by pressing pause.įind out how many shots you have fired. Lets tweak it! Invoke the setGunReloadTime method and set the reload time to 5. Use the arrow keys to move your spaceship and space bar to fire shots.ġ1 Exercise 1 After you’ve played the game for a little bit. Which classes can we create objects for? Place objects into the World, then click run. We can only create objects of classes that do not have subclasses. We can not place objects of it into the World. Superclasses – these classes are less specific Subclasses – these classes inherit the traits of the superclass, and then expands on them. How many subclasses of Mover are there? What are the subclasses of Actor?ħ Subclass Bullet, Rocket, and Asteroid are subclasses of MoverĮxplosion and Mover are subclasses of Actor While Bullet, Rocket and Asteroid are all subclasses of Mover as well as Actor, but are NOT subclasses of Explosion That is why the black screen automatically pops up.Ħ Actor Classes Under the World classes is the set of Actor classes. Space is a subclass of World.ĥ More on World When we open a scenario, greenfoot automatically creates an object of the World subclass, in this case Space. The arrow between the class represents an is-a relationship. Space is a specific class made for this scenario World ClassesĤ Inheritance In greenfoot you always a more specific class under World. Open Scenario, “asteroids1” in the chapter01 folder in book scenarios.ģ Class Diagram In Greenfoot, you always have a World class.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |