org.classroomgaming.cgp.Entity Class Reference

Inherits org::classroomgaming::cgp::GameModule.

Collaboration diagram for org.classroomgaming.cgp.Entity:
[legend]

List of all members.

Public Member Functions

 Entity (String n)
boolean addModule (String n, GameModule m)
void ponder (float t)
void render (Graphics g)
String getName ()
GameModule getModule (String name)
int getLayer ()
void setLayer (int z)
float getX ()
int getGridX ()
void setX (float x)
float getY ()
int getGridY ()
void setY (float y)
boolean testGrid (int x, int y)
boolean isPlayerControlled ()
void setPlayerControlled (boolean value)


Detailed Description

This class represents a logical entity in the game world. It contains global information about the object, such as its name and position, as well as a number of GameModules that define customized behaviors for that object.

Author:
Ryan Ruff
Version:
0.0.2 3/4/09

Definition at line 33 of file Entity.java.


Constructor & Destructor Documentation

org.classroomgaming.cgp.Entity.Entity ( String  n  ) 

Named constructor for game object

Parameters:
n Name of the new object

Definition at line 48 of file Entity.java.


Member Function Documentation

boolean org.classroomgaming.cgp.Entity.addModule ( String  n,
GameModule  m 
)

Adds a new module to the Game Object

Parameters:
n Name of the new module
m Module to add
Returns:
true if added successfully, false otherwise

Definition at line 63 of file Entity.java.

int org.classroomgaming.cgp.Entity.getGridX (  ) 

Get the object's x-position rounded to nearest integer

Returns:
rounded x position

Definition at line 151 of file Entity.java.

int org.classroomgaming.cgp.Entity.getGridY (  ) 

Get the objects current y position rounded to nearest integer

Returns:
rounded y position

Definition at line 175 of file Entity.java.

int org.classroomgaming.cgp.Entity.getLayer (  ) 

Get the object's layer, or z-position

Returns:
layer number

Definition at line 127 of file Entity.java.

GameModule org.classroomgaming.cgp.Entity.getModule ( String  name  ) 

Request a GameObjectModule by name

Parameters:
name Name of the module, assigned with add
Returns:
The GameObjectModule if it exists, NULL otherwise

Definition at line 119 of file Entity.java.

String org.classroomgaming.cgp.Entity.getName (  ) 

Public accessor for name

Returns:
The name of the GameObject

Definition at line 110 of file Entity.java.

float org.classroomgaming.cgp.Entity.getX (  ) 

Get the object's x-position (positive values to right)

Returns:
x position

Definition at line 143 of file Entity.java.

float org.classroomgaming.cgp.Entity.getY (  ) 

Get the object's current y position (positive values down)

Returns:
y position

Definition at line 167 of file Entity.java.

boolean org.classroomgaming.cgp.Entity.isPlayerControlled (  ) 

Determine if object is player controlled

Returns:
true if player controlled, false otherwise

Definition at line 200 of file Entity.java.

void org.classroomgaming.cgp.Entity.ponder ( float  t  ) 

Timed update procedure, which updates each module in turn

Parameters:
t time elapsed in seconds

Definition at line 75 of file Entity.java.

void org.classroomgaming.cgp.Entity.render ( Graphics  g  ) 

Render the current object on the screen

Todo:
Make this not pass through applet
Parameters:
app Source Java Applet
g Graphics object to render to

Definition at line 94 of file Entity.java.

void org.classroomgaming.cgp.Entity.setLayer ( int  z  ) 

Change the object's layer

Parameters:
z New layer

Definition at line 135 of file Entity.java.

void org.classroomgaming.cgp.Entity.setPlayerControlled ( boolean  value  ) 

Modify player controlled flag

Parameters:
value true if player controlled, false otherwise

Definition at line 208 of file Entity.java.

void org.classroomgaming.cgp.Entity.setX ( float  x  ) 

Change the object's x position

Parameters:
x New x position

Definition at line 159 of file Entity.java.

void org.classroomgaming.cgp.Entity.setY ( float  y  ) 

Change the object's current y position

Parameters:
y new y position

Definition at line 183 of file Entity.java.

boolean org.classroomgaming.cgp.Entity.testGrid ( int  x,
int  y 
)

Check to see if current object is in a specified grid tile

Parameters:
x horizonal position (+right)
y vertical position (+down)

Definition at line 192 of file Entity.java.


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

Generated on Tue May 5 04:51:56 2009 for CGP by  doxygen 1.5.8