public abstract class BasicSpaceship extends java.lang.Object implements Spaceship<BasicGameInfo>
Spaceship
for more info.Constructor and Description |
---|
BasicSpaceship() |
Modifier and Type | Method and Description |
---|---|
abstract ShipCommand |
getNextCommand(BasicEnvironment env) |
ShipCommand |
getNextCommand(Environment<BasicGameInfo> env)
Issues a command to be executed by this ship on the server.
|
abstract RegistrationData |
registerShip(int numImages,
int worldWidth,
int worldHeight)
Registers a ship with the server so it can begin issuing commands.
|
void |
shipDestroyed(java.lang.String lastDestroyedBy)
Notifies a ship that it has been destroyed and respawned.
|
public abstract RegistrationData registerShip(int numImages, int worldWidth, int worldHeight)
Spaceship
registerShip
in interface Spaceship<BasicGameInfo>
numImages
- the number of images available for the ship's
appearance on the serverworldWidth
- the width of the current world in pixelsworldHeight
- the height of the current world in pixelspublic abstract ShipCommand getNextCommand(BasicEnvironment env)
public ShipCommand getNextCommand(Environment<BasicGameInfo> env)
Spaceship
Commands are executed one at a time, except for non-blocking commands. Commands cannot be issued except when requested by the server. The server will process each command, then send the new environment (representing the result of the issued command and any actions taken by other entities in the game world) back to the ship and request a new command.
getNextCommand
in interface Spaceship<BasicGameInfo>
env
- the current environment provided by the serverpublic void shipDestroyed(java.lang.String lastDestroyedBy)
Spaceship
shipDestroyed
in interface Spaceship<BasicGameInfo>
lastDestroyedBy
- string containing the name of the player's ship or the object type name and #ID of the entity which destroyed your ship.