home *** CD-ROM | disk | FTP | other *** search
- #include "Dot.h"
- #include "Level.h"
-
- Dot::Dot( Level * level, Scene2D * scene, int x, int y )
- : Creature( level ),
- anim( scene, 1, "data/dot" ),
- 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 Dot::life_cycle(float delta_time)
- {
- anim.life_cycle( delta_time );
- }
-
- String Dot::get_name()const
- {
- return "Dot";
- }
-
- float Dot::get_size()const
- {
- return anim.get_width( 0, 0 );
- }
-
- void Dot::process_collision(const Creature * cre)
- {
- if ( cre->get_name() == "Pacman" )
- alive = false;
- }
-
- bool Dot::is_solid()const
- {
- return alive;
- }
-
- void Dot::process_death(const Creature * cre)
- {}
-
- bool Dot::is_alive()const
- {
- return alive;
- }
-