laMovingCreature Class Reference

Moving Creature. More...

#include <laMovingCreature.h>

Inheritance diagram for laMovingCreature:
laStateObject laObject laLoadableObj aiController laNamedClass laFightingCreature laMonster laPlayer

Public Member Functions

 laMovingCreature (rpgSheet *pSheet=NULL)
rpgSheetgetSheet ()
virtual void respawn ()
laPoint3 getOriginalPos ()
void enableControl (M_BOOL on=M_TRUE)
M_BOOL isControlEnabled ()
virtual void move (int direction)
int getMoveDirection ()
virtual void move_v (laPoint3 dir)
virtual M_BOOL jump ()
virtual void somersault ()
void setFaceDirection (int nDirection)
int getFaceDirection ()
void setExplicitFacing (M_BOOL bExplicit)
M_BOOL isFacingExplict ()
void animate (laTimer &t)
void drawGeometry (laRenderer *r, laPoint3 ptBasePos)
void _drawFx_positioned (laRenderer *r)
void load (class laFileParser *fp)
- Public Member Functions inherited from laStateObject
void state (unsigned nState, double dBlendTime=0.1)
void setBlendTime (double t)
laAnimatedModelgetStateModel ()
unsigned getState ()
virtual void _draw_positioned_rotated (laRenderer *r)
virtual void drawFx (laRenderer *r, laPoint3 ptBasePos)
virtual void create ()
- Public Member Functions inherited from laObject
void setLevel (class laLevel *plvl)
void setSegment (class laSegment *pseg)
void setTS (laTileset *pTileset)
void setObject (unsigned nTSObject, class laElement *pTSObject)
laLevelgetLevelObject ()
laSegmentgetSegmentObject ()
laTilesetgetTS ()
laElementgetObject ()
unsigned getObjectIndex ()
unsigned nestedAdd (laObject *p)
void nestedRemove (unsigned ID, M_BOOL bFreeMem=M_TRUE)
laObjectnestedGet (unsigned ID)
virtual void save (FILE *f)
virtual void create (laPoint3 pos)
void setOutline (laOutline o)
void setColor (laColor c)
void setLight (M_BOOL on)
virtual void drawInterface (laRenderer *r, laPoint3 ptBasePos)
void setPosition (laPoint3 pos)
laPoint3 getPosition ()
laPivotgetPivot ()
laRect2 boundingRect ()
- Public Member Functions inherited from laNamedClass
virtual std::string name ()=0
 Abstract naming method.
virtual laNamedClassinstantiate ()=0
 Abstract instantiate method.

Public Attributes

fxParticleSystem _fxTrail
- Public Attributes inherited from laObject
fxMessages fxMessages

Protected Member Functions

virtual unsigned _next_state (unsigned nCurrentState)
virtual void _update_facing (double dir_x)
- Protected Member Functions inherited from laObject
void _set_style (laRenderer *r)
void _offset (laRenderer *r, laPoint3 ptBasePos)
void _rotation (laRenderer *r)
void _offset_and_rotation (laRenderer *r, laPoint3 ptBasePos)
void _draw_shadow_fx (laRenderer *r)
void _nested_draw_fx (laRenderer *r, laPoint3 ptBasePos)
void _nested_draw_interface (laRenderer *r, laPoint3 ptBasePos)
void _nested_animate (laTimer &t)
void _nested_draw (laRenderer *r, laPoint3 ptBasePos)
void _nested_destroy ()
virtual void _drawFx_notrans (laRenderer *r, laPoint3 ptBasePos)
virtual void _drawFx_positioned_rotated (laRenderer *r)
virtual void _draw_notrans (laRenderer *r, laPoint3 ptBasePos)
virtual void _draw_positioned (laRenderer *r)
virtual void _execute_ai (laTimer &t)

Protected Attributes

M_BOOL _bControlEnabled
M_BOOL _bExplicitFacing
int _nFaceDirection
int _nMovementDirection
laTimeTrig _ttTurn
M_BOOL _bJumping
laTimeTrig _ttSomersault
laPivot _ptOriginPos
- Protected Attributes inherited from laStateObject
laAnimatedModel _animBlend
laStaticModel _snapshot
double _dBlendTime
unsigned _nState
- Protected Attributes inherited from laObject
laPivot _ptPivot
laColor _color
laOutline _outline
M_BOOL _bLightOn
unsigned _nNext_ID
std::map< unsigned, laObject * > _mNestedObjects
aiAgent _ai

Additional Inherited Members

- Static Protected Attributes inherited from laObject
static laTexture _texShadow

Detailed Description

Moving Creature.

Copyright (C) 2007-2013 Atanas Laskov, latan.nosp@m.as@g.nosp@m.mail..nosp@m.com

Definition at line 41 of file laMovingCreature.h.

Member Function Documentation

void laMovingCreature::move ( int  direction)


Definition at line 146 of file laMovingCreature.cpp.

147 {
148  if(!isControlEnabled()) return;
150  if( direction!=_nMovementDirection )
151  {
152  //double OldSpeedModifier = M_PLAYER_SPEED * _nMovementDirection * M_UNIT;
153  double NewSpeedModifier = ((rpgSheet_Acrobate*)_pSheet)->modSpeed() * direction ;
155  //If the player is was already moving
156  if(_nMovementDirection)
157  {
158  //...Remove any residual waking velocity
160  //if( M_SIGN(_ptPivot.velocity.x()-OldSpeedModifier) != M_SIGN(_ptPivot.velocity.x()) )
161  _ptPivot.velocity.x(0);
162  //else
163  // _ptPivot.velocity[0] -= OldSpeedModifier;
165  }
167  //Add the new waking velocity (if direction=0 the player will stop)
168  _ptPivot.velocity.x(NewSpeedModifier); /*+=*/
170  //Update playar waking state
171  _nMovementDirection = direction;
172  }
174  _update_facing( (double) _nMovementDirection );
175 }
Acrobatics RPG Properties.
void laMovingCreature::somersault ( )


Definition at line 230 of file laMovingCreature.cpp.

231 {
232  if(!isControlEnabled()) return;
234  // NOTE: if there is not _bSomersaultPerformed check,
235  // then its possible to make multiple somersaults
236  // if the player is quick - it is better without the check
238  if( (_ptPivot.velocity.y()<0) /*&& (!_bSomersaultPerformed)*/ )
239  {
240  fxMessages.add(0.8, laColor(255,255,0), "Hop!");
242  double NewSpeedModifier = ((rpgSheet_Acrobate*)_pSheet)->modSPower() ;
243  _ptPivot.velocity.y( _ptPivot.velocity.y() - NewSpeedModifier);
245  _ttSomersault.reset();
246  _ttSomersault.enable();
247  }
248 }
Animated Text Effect.
Definition: fxMessages.h:64
Acrobatics RPG Properties.

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