home *** CD-ROM | disk | FTP | other *** search
- #include "PowerDot.h"
- #include "Level.h"
-
- PowerDot::PowerDot( Level * level, Scene2D * scene, int x, int y )
- : Creature( level ),
- anim( scene, 1, "data/bigdot" ),
- alive( true )
- {
- anim.start( 0, true );
- const int cell_size = level->get_cell_size();
- const int anim_shift = int(cell_size - anim.get_width(0,0))/2;
- const Coord coord ( cell_size*x, cell_size*y );
- pos = Position( coord, coord, cell_size );
- anim.move( cell_size*x+anim_shift, cell_size*y+anim_shift );
- }
-
- void PowerDot::life_cycle(float delta_time)
- {
- anim.life_cycle( delta_time );
- }
-
- String PowerDot::get_name()const
- {
- return "PowerDot";
- }
-
- float PowerDot::get_size()const
- {
- return anim.get_width( 0, 0 );
- }
-
- void PowerDot::process_collision(const Creature * cre)
- {
- if ( cre->get_name() == "Pacman" )
- alive = false;
- }
-
- bool PowerDot::is_solid()const
- {
- return alive;
- }
-
- void PowerDot::process_death(const Creature * cre)
- {
- }
-
- bool PowerDot::is_alive()const
- {
- return alive;
- }
-