[Supertux-Commit] r5508 - in trunk/supertux: data/images/creatures/mr_bomb src/badguy

grumbel at millhouse.dreamhost.com grumbel at millhouse.dreamhost.com
Thu May 22 13:20:44 PDT 2008


Author: grumbel
Date: 2008-05-22 13:20:43 -0700 (Thu, 22 May 2008)
New Revision: 5508

Added:
   trunk/supertux/data/images/creatures/mr_bomb/exploding-left-4.png
Modified:
   trunk/supertux/data/images/creatures/mr_bomb/bomb.sprite
   trunk/supertux/data/images/creatures/mr_bomb/exploding-left-1.png
   trunk/supertux/data/images/creatures/mr_bomb/exploding-left-2.png
   trunk/supertux/data/images/creatures/mr_bomb/exploding-left-3.png
   trunk/supertux/data/images/creatures/mr_bomb/mr_bomb.sprite
   trunk/supertux/src/badguy/mrbomb.cpp
   trunk/supertux/src/badguy/mrbomb.hpp
Log:
Rolled back bomb to old behaviour, some bomb gfx tuning

Modified: trunk/supertux/data/images/creatures/mr_bomb/bomb.sprite
===================================================================
--- trunk/supertux/data/images/creatures/mr_bomb/bomb.sprite	2008-05-22 19:22:12 UTC (rev 5507)
+++ trunk/supertux/data/images/creatures/mr_bomb/bomb.sprite	2008-05-22 20:20:43 UTC (rev 5508)
@@ -2,21 +2,43 @@
  
  (action
   (name "ticking-left")
-  (fps 15.0)
-  (hitbox 4 6 32 34)
-  (images "exploding-left-0.png"
-          "exploding-left-1.png"
-          "exploding-left-2.png"
-          "exploding-left-3.png"
-          "exploding-left-2.png"
-          "exploding-left-1.png"
-          ))
- 
+  (fps 5.0)
+  (hitbox 5 8 32 32)
+  (images
+   "exploding-left-0.png"
+   "exploding-left-1.png"
+   "exploding-left-2.png"
+   "exploding-left-3.png"
+   "exploding-left-4.png"
+   "exploding-left-3.png"
+   "exploding-left-2.png"
+   "exploding-left-1.png"
+   "exploding-left-0.png"
+   "exploding-left-1.png"
+   "exploding-left-2.png"
+   "exploding-left-3.png"
+   "exploding-left-4.png"
+   "exploding-left-3.png"
+   "exploding-left-2.png"
+   "exploding-left-1.png"
+   "exploding-left-0.png"
+   "exploding-left-2.png"
+   "exploding-left-4.png"
+   "exploding-left-2.png"
+   "exploding-left-0.png"
+   "exploding-left-2.png"
+   "exploding-left-4.png"
+   "exploding-left-2.png"
+   "exploding-left-0.png"
+   "exploding-left-4.png"
+   "exploding-left-0.png"
+   "exploding-left-4.png"
+   )) 
  (action
   (name "ticking-right")
-  (fps 15.0)
-  (hitbox 10 8 31.8 31.8)
+  (fps 5.0)
+  (hitbox 5 8 32 32)
   (mirror-action "ticking-left"))
  
-)
+ )
 

Modified: trunk/supertux/data/images/creatures/mr_bomb/exploding-left-1.png
===================================================================
(Binary files differ)

Modified: trunk/supertux/data/images/creatures/mr_bomb/exploding-left-2.png
===================================================================
(Binary files differ)

Modified: trunk/supertux/data/images/creatures/mr_bomb/exploding-left-3.png
===================================================================
(Binary files differ)

Added: trunk/supertux/data/images/creatures/mr_bomb/exploding-left-4.png
===================================================================
(Binary files differ)


Property changes on: trunk/supertux/data/images/creatures/mr_bomb/exploding-left-4.png
___________________________________________________________________
Name: svn:mime-type
   + image/png

Modified: trunk/supertux/data/images/creatures/mr_bomb/mr_bomb.sprite
===================================================================
--- trunk/supertux/data/images/creatures/mr_bomb/mr_bomb.sprite	2008-05-22 19:22:12 UTC (rev 5507)
+++ trunk/supertux/data/images/creatures/mr_bomb/mr_bomb.sprite	2008-05-22 20:20:43 UTC (rev 5508)
@@ -2,7 +2,7 @@
  (action
   (name "left")
   (fps 10.0)
-  (hitbox 4 6 32 34)
+  (hitbox 5 8 32 32)
   (images "left.png"
           "center.png"
           "right.png"
@@ -11,7 +11,7 @@
  (action
   (name "right")
   (fps 10.0)
-  (hitbox 4 6 32 34)
+  (hitbox 5 8 32 32)
   (mirror-action "left"))
  
  (action
@@ -27,16 +27,42 @@
  (action
   (name "ticking-left")
   (fps 10.0)
-  (hitbox 3 12 31.8 31.8)
-  (images "ticking-0.png"
-          "ticking-1.png"
-          "ticking-2.png"
-          "ticking-3.png"))
+  (hitbox 5 8 32 32)
+  (images "exploding-left-0.png"
+          "exploding-left-1.png"
+          "exploding-left-2.png"
+          "exploding-left-3.png"
+          "exploding-left-4.png"
+          "exploding-left-3.png"
+          "exploding-left-2.png"
+          "exploding-left-1.png"
+          "exploding-left-0.png"
+          "exploding-left-1.png"
+          "exploding-left-2.png"
+          "exploding-left-3.png"
+          "exploding-left-4.png"
+          "exploding-left-3.png"
+          "exploding-left-2.png"
+          "exploding-left-1.png"
+          "exploding-left-0.png"
+          "exploding-left-2.png"
+          "exploding-left-4.png"
+          "exploding-left-2.png"
+          "exploding-left-0.png"
+          "exploding-left-2.png"
+          "exploding-left-4.png"
+          "exploding-left-2.png"
+          "exploding-left-0.png"
+          "exploding-left-4.png"
+          "exploding-left-0.png"
+          "exploding-left-4.png"
+          ))
+
  
  (action
   (name "ticking-right")
   (fps 10.0)
-  (hitbox 7 12 31.8 31.8)
+  (hitbox 5 8 32 32)
   (mirror-action "ticking-left"))
  
 )

Modified: trunk/supertux/src/badguy/mrbomb.cpp
===================================================================
--- trunk/supertux/src/badguy/mrbomb.cpp	2008-05-22 19:22:12 UTC (rev 5507)
+++ trunk/supertux/src/badguy/mrbomb.cpp	2008-05-22 20:20:43 UTC (rev 5508)
@@ -20,15 +20,11 @@
 #include <config.h>
 
 #include "mrbomb.hpp"
+#include "bomb.hpp"
 #include "object/explosion.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "audio/sound_manager.hpp"
-#include "level.hpp"
 
-namespace {
-  const float TICKING_TIME = 1.0f; /**< delay until ticking MrBomb explodes */
-}
-
 MrBomb::MrBomb(const lisp::Lisp& reader)
 	: WalkingBadguy(reader, "images/creatures/mr_bomb/mr_bomb.sprite", "left", "right")
 {
@@ -36,16 +32,9 @@
   max_drop_height = 16;
   grabbed = false;
 
+  //Prevent stutter when Tux jumps on Mr Bomb
   sound_manager->preload("sounds/explosion.wav");
 
-  ticking.reset(sound_manager->create_sound_source("sounds/fizz.wav"));
-  ticking->set_position(get_pos());
-  ticking->set_looping(true);
-  ticking->set_gain(2.0);
-  ticking->set_reference_distance(32);
-
-  state = STATE_IDLE;
-
   //Check if we need another sprite
   if( !reader.get( "sprite", sprite_name ) ){
     return;
@@ -66,14 +55,6 @@
   max_drop_height = 16;
   grabbed = false;
   sound_manager->preload("sounds/explosion.wav");
-
-  state = STATE_IDLE;
-
-  ticking.reset(sound_manager->create_sound_source("sounds/fizz.wav"));
-  ticking->set_position(get_pos());
-  ticking->set_looping(true);
-  ticking->set_gain(2.0);
-  ticking->set_reference_distance(32);
 }
 
 void
@@ -103,58 +84,21 @@
 bool
 MrBomb::collision_squished(GameObject& object)
 {
-  if(frozen) unfreeze();
-  Player* player = dynamic_cast<Player*>(&object);
-  if (player) {
-    player->bounce(*this);
-  }
-  if (state == STATE_IDLE) {
-    if (player && countMe) Sector::current()->get_level()->stats.badguys++;
-    state = STATE_TICKING;
-
-    // TODO: currently we need to re-create ticking sound object every time, in case we had to stop it
-    ticking.reset(sound_manager->create_sound_source("sounds/fizz.wav"));
-    ticking->set_position(get_pos());
-    ticking->set_looping(true);
-    ticking->set_gain(2.0);
-    ticking->set_reference_distance(32);
-
-    ticking->play();
-    ticking_timer.start(TICKING_TIME);
-    walk_left_action = "ticking-left";
-    walk_right_action = "ticking-right";
-    sprite->set_action(dir == LEFT ? walk_left_action : walk_right_action);
-  }
+  remove_me();
+  Sector::current()->add_object(new Bomb(get_pos(), dir, sprite_name ));
+  kill_squished(object);
   return true;
 }
 
 void
 MrBomb::active_update(float elapsed_time)
 {
-  if (state == STATE_TICKING) {
-    ticking->set_position(get_pos());
-    if(ticking_timer.check()) {
-      explode();
-    }
-  }
   if(grabbed)
     return;
   WalkingBadguy::active_update(elapsed_time);
 }
 
 void
-MrBomb::explode()
-{
-  ticking->stop();
-
-  remove_me();
-  Explosion* explosion = new Explosion(get_bbox().get_middle());
-  Sector::current()->add_object(explosion);
-
-  run_dead_script();
-}
-
-void
 MrBomb::kill_fall()
 {
   remove_me();
@@ -188,21 +132,8 @@
 {
   WalkingBadguy::freeze();
   sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
-  if (state == STATE_TICKING) {
-    ticking_timer.stop();
-    ticking->stop();
-    walk_left_action = "left";
-    walk_right_action = "right";
-    state = STATE_IDLE;
-  }
 }
 
-void
-MrBomb::unfreeze()
-{
-  WalkingBadguy::unfreeze();
-}
-
 bool
 MrBomb::is_freezable() const
 {

Modified: trunk/supertux/src/badguy/mrbomb.hpp
===================================================================
--- trunk/supertux/src/badguy/mrbomb.hpp	2008-05-22 19:22:12 UTC (rev 5507)
+++ trunk/supertux/src/badguy/mrbomb.hpp	2008-05-22 20:20:43 UTC (rev 5508)
@@ -41,21 +41,11 @@
   bool is_portable() const;
 
   void freeze();
-  void unfreeze();
   bool is_freezable() const;
 
-  void explode();
+  virtual MrBomb* clone() const { return new MrBomb(*this); }
 
 protected:
-  enum State {
-    STATE_IDLE,
-    STATE_TICKING
-  };
-
-  State state;
-  std::auto_ptr<SoundSource> ticking;
-  Timer ticking_timer;
-
   bool collision_squished(GameObject& object);
 
 private:




More information about the Supertux-Commit mailing list