game.physics
Class CDynamicShape

java.lang.Object
  extended by game.physics.CStaticShape
      extended by game.physics.CDynamicShape
Direct Known Subclasses:
CAnimatedSprite, CColoredDynamicShape, CMovingText

public abstract class CDynamicShape
extends CStaticShape

Extends CStatic shape by adding movement. It has a velocity, it can bounce, wrap, and be subjected to gravity.

Author:
sroccaserra

Field Summary
static float G
           
protected  boolean m_bApplyGravity
           
protected  boolean m_bBouceOnGameRect
           
protected  CVector2D m_v
           
 
Fields inherited from class game.physics.CStaticShape
m_box, m_gameDisplay, m_isHidden
 
Constructor Summary
CDynamicShape(IGameDisplay gameRect, CBoundingBox boundingBox, CVector2D velocity)
           
 
Method Summary
 void animate(float dt)
          Does nothing (static shapes don't move).
private  void applyGravity(float dt)
           
protected  void bounceOnGameRect()
           
 void cycle()
          Does nothing.
 CVector2D getVelocity()
          Returns a null vector (static shapes don't move).
(package private)  void wrapAtGameLimits()
           
 
Methods inherited from class game.physics.CStaticShape
drawBox, getCenter, hide, intersect, isHidden, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

G

public static final float G
See Also:
Constant Field Values

m_v

protected CVector2D m_v

m_bApplyGravity

protected boolean m_bApplyGravity

m_bBouceOnGameRect

protected boolean m_bBouceOnGameRect
Constructor Detail

CDynamicShape

public CDynamicShape(IGameDisplay gameRect,
                     CBoundingBox boundingBox,
                     CVector2D velocity)
Method Detail

getVelocity

public final CVector2D getVelocity()
Description copied from class: CStaticShape
Returns a null vector (static shapes don't move).

Overrides:
getVelocity in class CStaticShape
Returns:
a null vector.

cycle

public void cycle()
Description copied from class: CStaticShape
Does nothing. Override at will.

Overrides:
cycle in class CStaticShape

animate

public void animate(float dt)
Description copied from class: CStaticShape
Does nothing (static shapes don't move).

Overrides:
animate in class CStaticShape

applyGravity

private final void applyGravity(float dt)

bounceOnGameRect

protected void bounceOnGameRect()

wrapAtGameLimits

final void wrapAtGameLimits()