|
||||||
|
|
|
Space Oddysy: Chapter 3 Lets have a look at the Ship class. public abstract class Ship implements Artifact, Moving,Serializable
{ A ship has postion, speed, direction, health and armour. (Health and armour are not currently used, but lets have them for future). But we donot have enough information to tell about the size of the ship which is required by the Artifact interface. So we have to make the Ship class abstract. We will subclass the ship to get the different types of ships: Since in our game, the player's ship is only of one type, we donot need to subclass the HeroShip. But the HelperShips and EnemyShips are of various types so we subclass them as needed.
|
| ©2005 Shabda Raaj | SpaceOddysy | BIT, Mesra | Middle-Earth | SCJP | Java Gaming | My Personal Blog |