Top Description Fields Constructors Methods
org.lwjgl.examples.spaceinvaders

public Class ShipEntity

extends Entity
Class Inheritance

The entity that represents the players ship
Authors
Kevin Glass, Brian Matzon

Field Summary

Modifier and TypeField and Description
private Game
game

The game in which the ship exists

private static final int
LEFT_BORDER

Left border at which to disallow further movement

private static final int
RIGHT_BORDER

Right border at which to disallow further movement

Inherited from org.lwjgl.examples.spaceinvaders.Entity:
dxdyspritexy

Constructor Summary

AccessConstructor and Description
public
ShipEntity(Game
The game in which the ship is being created
game
,
String
The reference to the sprite to show for the ship
ref
,
int
The initial x location of the player's ship
x
,
int
The initial y location of the player's ship
y
)

Create a new entity to represent the players ship

Method Summary

Modifier and TypeMethod and Description
public void
collidedWith(Entity
The entity with which the ship has collided
other
)

Implements abstract org.lwjgl.examples.spaceinvaders.Entity.collidedWith.

Notification that the player's ship has collided with something
public void
move(long
The time that has elapsed since last move (ms)
delta
)

Overrides org.lwjgl.examples.spaceinvaders.Entity.move.

Request that the ship move itself based on an elapsed ammount of time
Inherited from org.lwjgl.examples.spaceinvaders.Entity:
collidesWithdoLogicdrawgetHorizontalMovementgetVerticalMovementgetXgetYsetHorizontalMovementsetVerticalMovement

Field Detail

gameback to summary
private Game game

The game in which the ship exists

LEFT_BORDERback to summary
private static final int LEFT_BORDER

Left border at which to disallow further movement

RIGHT_BORDERback to summary
private static final int RIGHT_BORDER

Right border at which to disallow further movement

Constructor Detail

ShipEntityback to summary
public ShipEntity(Game game, String ref, int x, int y)

Create a new entity to represent the players ship

Parameters
game:Game

The game in which the ship is being created

ref:String

The reference to the sprite to show for the ship

x:int

The initial x location of the player's ship

y:int

The initial y location of the player's ship

Method Detail

collidedWithback to summary
public void collidedWith(Entity other)

Implements abstract org.lwjgl.examples.spaceinvaders.Entity.collidedWith.

Notification that the player's ship has collided with something

Parameters
other:Entity

The entity with which the ship has collided

moveback to summary
public void move(long delta)

Overrides org.lwjgl.examples.spaceinvaders.Entity.move.

Request that the ship move itself based on an elapsed ammount of time

Parameters
delta:long

The time that has elapsed since last move (ms)