simogl.model
Class AbstractMD2Model

java.lang.Object
  extended by simogl.model.AbstractMD2Model
Direct Known Subclasses:
MD2CityHall, MD2Civilian, MD2Elder, MD2Farm, MD2Farmer, MD2House

public abstract class AbstractMD2Model
extends java.lang.Object

This class represents a model that has been loaded from a md2 file. Such models are usually used as characters in the game. Notice, that this is an abstract class. You cannot intanciate an object of this class directly.

Author:
Frank Bruns

Field Summary
static int STAND
           
static int WALK
           
 
Constructor Summary
AbstractMD2Model(float x, float y, float z)
          Creates a new md2 model at the specified location
 
Method Summary
 Animation getCurrentAnim()
          Returns the animation that is currently assigned to the model.
 int getCurrentAnimState()
          Returns the int that symbolizes the current animation state like "WALK" or "STAND".
 void setAnimationState(int state)
          Sets the current animation of the model.
 void update(long elapsedTime)
          Updates a md2 model
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WALK

public static final int WALK
See Also:
Constant Field Values

STAND

public static final int STAND
See Also:
Constant Field Values
Constructor Detail

AbstractMD2Model

public AbstractMD2Model(float x,
                        float y,
                        float z)
Creates a new md2 model at the specified location

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate
Method Detail

setAnimationState

public void setAnimationState(int state)
Sets the current animation of the model. Use it e.g. in the following way.

goblinModelObject.setAnimation(MD2Goblin.WALK)

Parameters:
state - a constant that defines an animation state

getCurrentAnim

public Animation getCurrentAnim()
Returns the animation that is currently assigned to the model.

Returns:
the current animation of the model

getCurrentAnimState

public int getCurrentAnimState()
Returns the int that symbolizes the current animation state like "WALK" or "STAND".

Returns:
current animation state

update

public void update(long elapsedTime)
Updates a md2 model

Parameters:
elapsedTime - time between two frames