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