game.graphics
Class CSparkle

java.lang.Object
  extended by game.physics.CStaticShape
      extended by game.physics.CDynamicShape
          extended by game.physics.CColoredDynamicShape
              extended by game.graphics.CSparkle
All Implemented Interfaces:
IEphemereObject, IGraphicObject

public class CSparkle
extends CColoredDynamicShape
implements IEphemereObject

Like all IEphemereObjects, CSparkles have a limited lifetime. Some bounce on the limits, some fly away, some are affected by gravity, others are not.

Author:
sroccaserra

Field Summary
private static int ALT_SIZE
           
private  boolean m_isVertical
           
private  float m_lifetime
           
private  float m_offset
           
private  int m_variableSize
           
private static float RANDOM_VELOCITY
           
private static int SIZE
           
 
Fields inherited from class game.physics.CColoredDynamicShape
m_color
 
Fields inherited from class game.physics.CDynamicShape
G, m_bApplyGravity, m_bBouceOnGameRect, m_v
 
Fields inherited from class game.physics.CStaticShape
m_box, m_gameDisplay, m_isHidden
 
Constructor Summary
CSparkle(IGameDisplay gameRect, CVector2D position, CVector2D velocity, float lifetime)
           
 
Method Summary
 void animate(float dt)
          Does nothing (static shapes don't move).
 void cycle()
          Does nothing.
 void draw(java.awt.Graphics g)
           
 boolean intersect(float x, float y)
          Checks for intersection with a 2D point.
 boolean isDead()
           
 
Methods inherited from class game.physics.CDynamicShape
bounceOnGameRect, getVelocity
 
Methods inherited from class game.physics.CStaticShape
drawBox, getCenter, hide, isHidden, show
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface game.graphics.IGraphicObject
getCenter, getVelocity
 

Field Detail

SIZE

private static final int SIZE
See Also:
Constant Field Values

ALT_SIZE

private static final int ALT_SIZE
See Also:
Constant Field Values

RANDOM_VELOCITY

private static final float RANDOM_VELOCITY
See Also:
Constant Field Values

m_isVertical

private final boolean m_isVertical

m_offset

private final float m_offset

m_lifetime

private float m_lifetime

m_variableSize

private int m_variableSize
Constructor Detail

CSparkle

public CSparkle(IGameDisplay gameRect,
                CVector2D position,
                CVector2D velocity,
                float lifetime)
Method Detail

animate

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

Specified by:
animate in interface IGraphicObject
Overrides:
animate in class CDynamicShape

cycle

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

Specified by:
cycle in interface IGraphicObject
Overrides:
cycle in class CDynamicShape

draw

public void draw(java.awt.Graphics g)
Specified by:
draw in interface IGraphicObject

isDead

public final boolean isDead()
Specified by:
isDead in interface IEphemereObject

intersect

public final boolean intersect(float x,
                               float y)
Description copied from class: CStaticShape
Checks for intersection with a 2D point.

Specified by:
intersect in interface IGraphicObject
Overrides:
intersect in class CStaticShape
Returns:
true if the point is within the shape's bounding box.