June 2015
Intermediate to advanced
388 pages
7h 31m
English
We need to keep the model part of our code as separate as possible from the rest. We can do this by creating a class for our player's spaceship. Let's call our new class PlayerShip.
Go ahead and add a new class to the project, and call it PlayerShip. Here are a few quick steps on how to do that. Now, right-click the folder with our .java files in it and navigate to New | Java Class, then enter PlayerShip as the name and click on OK.
What do we need our PlayerShip class to be able to know about itself? As a bare minimum it needs to:
These requirements suggest a few member variables we can declare. Enter the code just after the class declaration that we generated: ...
Read now
Unlock full access