[Super-tux-commit] supertux/src/badguy bomb.cpp,1.7,1.8 bomb.h,1.3,1.4 mrbomb.cpp,1.11,1.12 mrbomb.h
Brought to you by:
wkendrick
From: Matze B. <mat...@us...> - 2005-04-04 14:14:37
|
Update of /cvsroot/super-tux/supertux/src/badguy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18723/src/badguy Modified Files: bomb.cpp bomb.h mrbomb.cpp mrbomb.h Log Message: explode bombs instead ofletting them fall down when hit Index: bomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bomb.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- bomb.cpp 20 Dec 2004 21:24:26 -0000 1.7 +++ bomb.cpp 4 Apr 2005 14:14:12 -0000 1.8 @@ -55,11 +55,7 @@ switch(state) { case 0: if(timer.check()) { - state = 1; - sprite->set_action("explosion"); - SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), get_pos(), - Sector::current()->player->get_pos()); - timer.start(EXPLOSIONTIME); + explode(); } break; case 1: @@ -71,7 +67,18 @@ } void +Bomb::explode() +{ + state = 1; + sprite->set_action("explosion"); + SoundManager::get()->play_sound(IDToSound(SND_EXPLODE), get_pos(), + Sector::current()->player->get_pos()); + timer.start(EXPLOSIONTIME); +} + +void Bomb::kill_fall() { + explode(); } Index: mrbomb.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mrbomb.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- mrbomb.cpp 20 Dec 2004 21:24:27 -0000 1.11 +++ mrbomb.cpp 4 Apr 2005 14:14:12 -0000 1.12 @@ -78,4 +78,13 @@ return CONTINUE; } +void +MrBomb::kill_fall() +{ + remove_me(); + Bomb* bomb = new Bomb(get_pos(), dir); + Sector::current()->add_object(bomb); + bomb->explode(); +} + IMPLEMENT_FACTORY(MrBomb, "mrbomb") Index: mrbomb.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/mrbomb.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- mrbomb.h 29 Nov 2004 00:12:24 -0000 1.5 +++ mrbomb.h 4 Apr 2005 14:14:13 -0000 1.6 @@ -13,6 +13,7 @@ void write(lisp::Writer& writer); HitResponse collision_solid(GameObject& other, const CollisionHit& hit); HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); + void kill_fall(); protected: bool collision_squished(Player& player); Index: bomb.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy/bomb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- bomb.h 29 Nov 2004 00:12:24 -0000 1.3 +++ bomb.h 4 Apr 2005 14:14:12 -0000 1.4 @@ -14,6 +14,7 @@ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); void active_action(float elapsed_time); void kill_fall(); + void explode(); private: int state; |