Cannot figure it out.
Why do we need the Space class?
To store all the objects and control how they interact.
What fields should it have?
width and height.
What else?
a) ship (our spaceship),
b) a list to store all the UFOs (List<Ufo>),
c) a list to store all the rockets (List<Rocket>),
d) a list to store all the bombs (List<Bomb>).
Task:
Add all these variables to the Space class.
Initialize the collections.
And don't forget to add getters for the variables, and also a setter for the ship field!
What should the constructor have?
Parameters for the width and height will suffice.
Requirements:
- Create a width field in the Space class. Add a getter for it.
- Create a height field in the Space class. Add a getter for it.
- Create a ship field in the Space class. Add a getter and setter for it.
- Create a ufos field in the Space class. Add a getter for it.
- Create a rockets field in the Space class. Add a getter for it.
- Create a bombs field in the Space class. Add a getter for it.
- In the Space class, create a constructor that initializes the width and height fields.
- Initialize the fields that store collections.
package com.codegym.task.task25.task2515;
public class Ufo extends BaseObject {
}