Methapolis  0.27
 All Classes Namespaces Files Functions Variables Enumerator
micropolisj.engine.Sprite Class Reference
Inheritance diagram for micropolisj.engine.Sprite:
Collaboration diagram for micropolisj.engine.Sprite:

Public Member Functions

void setMicropolis (Micropolis micro)
final void move ()
final boolean isVisible ()
void remove ()

Public Attributes

SpriteKind kind
int offx
int offy
int width = 32
int height = 32
int frame
int x
int y
int lastX
int lastY

Protected Member Functions

 Sprite (Micropolis engine, SpriteKind kind)
final int getChar (int x, int y)
int tilePosToPixel (int x)
int pixelToTilePos (int x)
abstract void moveImpl ()
void explodeSprite ()

Detailed Description

Represents a mobile entity on the city map, such as a tornado or a train. There can be any number present in a city, and each one gets a chance to act on every tick of the simulation.

See Also
Micropolis::moveObjects

Definition at line 29 of file Sprite.java.

Constructor & Destructor Documentation

micropolisj.engine.Sprite.Sprite ( Micropolis  engine,
SpriteKind  kind 
)
protected

Definition at line 51 of file Sprite.java.

References micropolisj.engine.Sprite.kind.

Member Function Documentation

final int micropolisj.engine.Sprite.getChar ( int  x,
int  y 
)
protected
final boolean micropolisj.engine.Sprite.isVisible ( )

Tells whether this sprite is visible.

Definition at line 99 of file Sprite.java.

References micropolisj.engine.Sprite.frame.

final void micropolisj.engine.Sprite.move ( )

Perform this agent's movement and animation.

Definition at line 89 of file Sprite.java.

References micropolisj.engine.Sprite.lastX, micropolisj.engine.Sprite.lastY, micropolisj.engine.Sprite.moveImpl(), micropolisj.engine.Sprite.x, and micropolisj.engine.Sprite.y.

Here is the call graph for this function:

abstract void micropolisj.engine.Sprite.moveImpl ( )
protectedpure virtual

For subclasses to override. Actually does the movement and animation of this particular sprite. Setting this.frame to zero will cause the sprite to be unallocated.

Implemented in micropolisj.engine.RocketSprite, micropolisj.engine.MonsterSprite, micropolisj.engine.SpaceshipSprite, micropolisj.engine.ShipSprite, micropolisj.engine.TrainSprite, micropolisj.engine.AirplaneSprite, micropolisj.engine.HelicopterSprite, micropolisj.engine.ExplosionSprite, and micropolisj.engine.TornadoSprite.

Referenced by micropolisj.engine.Sprite.move().

int micropolisj.engine.Sprite.pixelToTilePos ( int  x)
protected

Definition at line 75 of file Sprite.java.

void micropolisj.engine.Sprite.remove ( )

Definition at line 191 of file Sprite.java.

References micropolisj.engine.Micropolis.sprites.

void micropolisj.engine.Sprite.setMicropolis ( Micropolis  micro)

Definition at line 56 of file Sprite.java.

int micropolisj.engine.Sprite.tilePosToPixel ( int  x)
protected

Member Data Documentation

SpriteKind micropolisj.engine.Sprite.kind
int micropolisj.engine.Sprite.lastX

Definition at line 46 of file Sprite.java.

Referenced by micropolisj.engine.Sprite.move().

int micropolisj.engine.Sprite.lastY

Definition at line 47 of file Sprite.java.

Referenced by micropolisj.engine.Sprite.move().


The documentation for this class was generated from the following file: