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

public Class ShotEntity

extends Entity
Class Inheritance

An entity representing a shot fired by the player's ship
Authors
Kevin Glass, Brian Matzon

Field Summary

Modifier and TypeField and Description
private Game
game

The game in which this entity exists

private float
moveSpeed

The vertical speed at which the players shot moves

private static final int
TOP_BORDER

Top border at which shots are outside

private boolean
used

True if this shot has been "used", i.e. its hit something

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

Constructor Summary

AccessConstructor and Description
public
ShotEntity(Game
The game in which the shot has been created
game
,
String
The sprite representing this shot
sprite
,
int
The initial x location of the shot
x
,
int
The initial y location of the shot
y
)

Create a new shot from the player

Method Summary

Modifier and TypeMethod and Description
public void
collidedWith(Entity
The other entity with which we've collided
other
)

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

Notification that this shot has collided with another entity
public void
move(long
The time that has elapsed since last move
delta
)

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

Request that this shot moved based on time elapsed
public void
reinitialize(int
new x coordinate
x
,
int
new y coordinate
y
)

Reinitializes this entity, for reuse

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

Field Detail

gameback to summary
private Game game

The game in which this entity exists

moveSpeedback to summary
private float moveSpeed

The vertical speed at which the players shot moves

TOP_BORDERback to summary
private static final int TOP_BORDER

Top border at which shots are outside

usedback to summary
private boolean used

True if this shot has been "used", i.e. its hit something

Constructor Detail

ShotEntityback to summary
public ShotEntity(Game game, String sprite, int x, int y)

Create a new shot from the player

Parameters
game:Game

The game in which the shot has been created

sprite:String

The sprite representing this shot

x:int

The initial x location of the shot

y:int

The initial y location of the shot

Method Detail

collidedWithback to summary
public void collidedWith(Entity other)

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

Notification that this shot has collided with another entity

Parameters
other:Entity

The other entity with which we've collided

moveback to summary
public void move(long delta)

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

Request that this shot moved based on time elapsed

Parameters
delta:long

The time that has elapsed since last move

reinitializeback to summary
public void reinitialize(int x, int y)

Reinitializes this entity, for reuse

Parameters
x:int

new x coordinate

y:int

new y coordinate