home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2002 May / Game.EXE_05_2002.iso / Alawar / src / PowerDot.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-02  |  1002 b   |  51 lines

  1. #include "PowerDot.h"
  2. #include "Level.h"
  3.  
  4. PowerDot::PowerDot( Level * level, Scene2D * scene, int x, int y )
  5. :    Creature( level ),
  6.     anim( scene, 1, "data/bigdot" ),
  7.     alive( true )
  8. {
  9.     anim.start( 0, true );
  10.     const int cell_size = level->get_cell_size();
  11.     const int anim_shift = int(cell_size - anim.get_width(0,0))/2;
  12.     const Coord coord ( cell_size*x, cell_size*y );
  13.     pos = Position( coord, coord, cell_size );
  14.     anim.move( cell_size*x+anim_shift, cell_size*y+anim_shift );
  15. }
  16.  
  17. void PowerDot::life_cycle(float delta_time)
  18. {
  19.     anim.life_cycle( delta_time );
  20. }
  21.  
  22. String PowerDot::get_name()const
  23. {
  24.     return "PowerDot";
  25. }
  26.  
  27. float PowerDot::get_size()const
  28. {
  29.     return anim.get_width( 0, 0 );
  30. }
  31.  
  32. void PowerDot::process_collision(const Creature * cre)
  33. {
  34.     if ( cre->get_name() == "Pacman" )
  35.         alive = false;
  36. }
  37.  
  38. bool PowerDot::is_solid()const
  39. {
  40.     return alive;
  41. }
  42.  
  43. void PowerDot::process_death(const Creature * cre)
  44. {
  45. }
  46.  
  47. bool PowerDot::is_alive()const
  48. {
  49.     return alive;
  50. }
  51.