home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 February / maximum-cd-2009-02.iso / DiscContents / SMC_1.6_win32.exe / src / enemies / jpiranha.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-07-01  |  3.4 KB  |  111 lines

  1. /***************************************************************************
  2.  * jpiranha.h  -  headers for the corresponding cpp file
  3.  *
  4.  * Copyright (C) 2003 - 2008 Florian Richter
  5.  ***************************************************************************/
  6. /*
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License as published by
  9.    the Free Software Foundation; either version 3 of the License, or
  10.    (at your option) any later version.
  11.    
  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  14. */
  15.  
  16. #ifndef SMC_JPIRANHA_H
  17. #define SMC_JPIRANHA_H
  18.  
  19. #include "../enemies/enemy.h"
  20.  
  21. /* *** *** *** *** *** cjPiranha *** *** *** *** *** *** *** *** *** *** *** *** */
  22.  
  23. /* Jumping Piranha
  24.  * Eats your butt
  25. */
  26. class cjPiranha : public cEnemy 
  27. {
  28. public:
  29.     // constructor
  30.     cjPiranha( float x, float y );
  31.     // create from stream
  32.     cjPiranha( CEGUI::XMLAttributes &attributes );
  33.     // destructor
  34.     virtual ~cjPiranha( void );
  35.  
  36.     // initialize defaults
  37.     void Init( void );
  38.     // copy
  39.     virtual cjPiranha *Copy( void );
  40.  
  41.     // create from stream
  42.     virtual void Create_from_Stream( CEGUI::XMLAttributes &attributes );
  43.     // save to stream
  44.     virtual void Save_to_Stream( ofstream &file );
  45.  
  46.     // load from savegame
  47.     virtual void Load_from_Savegame( cSave_Level_Object *save_object );
  48.     // save to savegame
  49.     virtual cSave_Level_Object *Save_to_Savegame( void );
  50.  
  51.     // Set Direction
  52.     void Set_Direction( ObjectDirection dir );
  53.     // Set Max Distance
  54.     void Set_Max_Distance( float nmax_distance );
  55.     // Set the Speed
  56.     void Set_Speed( float val );
  57.  
  58.     /* downgrade state ( if already weakest state : dies )
  59.      * force : usually dies or a complete downgrade
  60.     */
  61.     virtual void DownGrade( bool force = 0 );
  62.     virtual void DieStep( void );
  63.  
  64.     // update
  65.     virtual void Update( void );
  66.     // draw
  67.     virtual void Draw( cSurfaceRequest *request = NULL );
  68.  
  69.     // Returns the distance to the end position
  70.     float Get_End_Distance( void );
  71.     // update destination velocity from the speed
  72.     void Update_Dest_Vel( void );
  73.  
  74.     // if update is valid for the current state
  75.     virtual bool Is_Update_Valid( void );
  76.     // if draw is valid for the current state and position
  77.     virtual bool Is_Draw_Valid( void );
  78.  
  79.     // ignore onground check
  80.     virtual void Check_on_Ground( void ) {};
  81.     /* Validate the given collision object
  82.      * returns 1 if an internal collision with this object is valid
  83.      * returns 2 if the given object collides with this object (blocking)
  84.     */
  85.     virtual unsigned int Validate_Collision( cSprite *obj );
  86.     // collision from player
  87.     virtual void Handle_Collision_Player( cObjectCollision *collision );
  88.     
  89.     // leveleditor activation
  90.     virtual void Editor_Activate( void );
  91.     // leveleditor events
  92.     bool Editor_Max_Distance_Key( const CEGUI::EventArgs &event );  // editor max distance key up
  93.     bool Editor_Speed_Key( const CEGUI::EventArgs &event );  // editor speed key up
  94.  
  95.     // moving speed
  96.     float speed;
  97.     // destination direction velocity
  98.     float dest_velx, dest_vely;
  99.     // maximum distance from the startposition
  100.     float max_distance;
  101.  
  102.     // time to wait until next approach
  103.     float wait_time;
  104.     // moving back to the original position
  105.     bool move_back;
  106. };
  107.  
  108. /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
  109.  
  110. #endif
  111.