JGameObject Class Reference

#include <JGameObject.h>

Inheritance diagram for JGameObject:
Collaboration diagram for JGameObject:

List of all members.

Public Member Functions

 JGameObject (JTexture *tex, float x, float y, float width, float height)
virtual void Update (float dt)
virtual void Render ()
virtual void OnCollide ()
void SetBBox (float x, float y, float width, float height)
void GetBBox (float x, float y, float *xNow, float *yNow, float *width, float *height)
void SetCollisionCircle (float cx, float cy, float radius)
bool Collide (JGameObject *target)
void SetCollisionTarget (JGameObject *target)
JGameObjectGetCollisionTarget ()
void SetHitPoint (int pt)
int GetHitPoint ()
void SetBlood (int pt)
int GetBlood ()
void EnableAlpha (bool flag, float delta=0.0f)
void EnableScaling (bool flag, float delta=0.0f)
void EnableRotation (bool flag, float delta=0.0f)
void SetRenderFlags (int flags)
void StartFlashing ()
void StopFlashing ()
bool IsFlashing ()


Detailed Description

A super Sprite class for in-game entities. Extra functions are added in addition to a normal Sprite for easier control of in-game activities.

Constructor & Destructor Documentation

JGameObject::JGameObject ( JTexture *  tex,
float  x,
float  y,
float  width,
float  height 
)

Constructor.

Parameters:
tex - Texture for first frame. NULL for no starting frame.
x - X position of texture for the frame.
y - Y position of texture for the frame.
width - Width of the frame.
height - Height of the frame.


Member Function Documentation

virtual void JGameObject::Update ( float  dt  )  [virtual]

Update function.

Parameters:
dt - Delta time since last update (in second).

Reimplemented from JSprite.

virtual void JGameObject::Render (  )  [virtual]

Render current frame.

Reimplemented from JSprite.

virtual void JGameObject::OnCollide (  )  [virtual]

Function to handle collision.

void JGameObject::SetBBox ( float  x,
float  y,
float  width,
float  height 
)

Set bounding box for collision detection. All the following collision detections will be done using bounding box.

Parameters:
x - X position of the bounding box (relative to this sprite).
y - Y position of the bounding box (relative to this sprite).
width - Width of the bounding box.
height - Height of the bounding box.

void JGameObject::GetBBox ( float  x,
float  y,
float *  xNow,
float *  yNow,
float *  width,
float *  height 
)

Get bounding box relative to screen position.

Parameters:
x - X of screen position.
y - Y of screen position.
Returns:
xNow - X position of the bounding box (relative to screen).

yNow - Y position of the bounding box (relative to screen).

width - Width of the bounding box.

height - Height of the bounding box.

void JGameObject::SetCollisionCircle ( float  cx,
float  cy,
float  radius 
)

Set up a circle for collision detection. All the following collision detections will be done using circle to circle collision detection.

Parameters:
cx - X of the circle center.
cy - Y of the circle center.
radius - Radius of the circle.

bool JGameObject::Collide ( JGameObject target  ) 

Check for collision. Either bounding box or circle to circle collision detection will be used depending on which one is setup last.

Parameters:
target - Target to check for collision.

void JGameObject::SetCollisionTarget ( JGameObject target  ) 

Set object that has collided with this object.

Parameters:
target - Object that has collided with this object.

JGameObject* JGameObject::GetCollisionTarget (  ) 

Get object that has collided with this object.

Returns:
Object that has collided with this object.

void JGameObject::SetHitPoint ( int  pt  ) 

Set damage point of this object.

Parameters:
pt - Damage point.

int JGameObject::GetHitPoint (  ) 

Get damage point of this object.

Returns:
Damage point.

void JGameObject::SetBlood ( int  pt  ) 

Set blood of this object.

Parameters:
pt - Blood value.

int JGameObject::GetBlood (  ) 

Get blood of this object.

Returns:
Blood value.

void JGameObject::EnableAlpha ( bool  flag,
float  delta = 0.0f 
)

Enable alpha animation during update.

Parameters:
flag - Enable flag.
delta - Rate of changing the alpha value.

void JGameObject::EnableScaling ( bool  flag,
float  delta = 0.0f 
)

Enable scaling during update.

Parameters:
flag - Enable flag.
delta - Rate of changing the scaling value.

void JGameObject::EnableRotation ( bool  flag,
float  delta = 0.0f 
)

Enable rotation during update.

Parameters:
flag - Enable flag.
delta - Rate of rotation.

void JGameObject::SetRenderFlags ( int  flags  ) 

Set rendering flags.

Parameters:
flags - Rendering flags encoded in bits.

void JGameObject::StartFlashing (  ) 

Start flashing during render.

void JGameObject::StopFlashing (  ) 

Start flashing during render.

bool JGameObject::IsFlashing (  ) 

Check if object is flashing.

Returns:
Flashing status.


Generated on Mon Oct 22 00:28:22 2007 for JGE++ by  doxygen 1.5.3