When creating a brick object to handle tiles with attribute brick the iced image...
authorWolfgang Becker <uafr@gmx.de>
Sun, 22 Sep 2013 00:07:06 +0000 (02:07 +0200)
committerTobias Markus <tobbi@mozilla-uk.org>
Sat, 26 Oct 2013 16:45:24 +0000 (18:45 +0200)
data/images/objects/bonus_block/brickIce.sprite [new file with mode: 0644]
src/object/brick.cpp
src/object/brick.hpp
src/supertux/sector.cpp

diff --git a/data/images/objects/bonus_block/brickIce.sprite b/data/images/objects/bonus_block/brickIce.sprite
new file mode 100644 (file)
index 0000000..d476506
--- /dev/null
@@ -0,0 +1,8 @@
+(supertux-sprite
+      (action
+        (name "empty")
+        (images "empty.png"))
+      (action
+        (name "normal")
+        (images "../../tiles/blocks/brick1.png"))
+)
index f9a1d61..f37c609 100644 (file)
@@ -26,8 +26,8 @@
 #include "supertux/constants.hpp"
 #include "supertux/sector.hpp"
 
-Brick::Brick(const Vector& pos, int data)
-  : Block(sprite_manager->create("images/objects/bonus_block/brick.sprite")), breakable(false),
+Brick::Brick(const Vector& pos, int data, const std::string& spriteName)
+  : Block(sprite_manager->create(spriteName)), breakable(false),
     coin_counter(0)
 {
   bbox.set_pos(pos);
index 617a3e9..15a3aa8 100644 (file)
@@ -22,7 +22,7 @@
 class Brick : public Block
 {
 public:
-  Brick(const Vector& pos, int data);
+  Brick(const Vector& pos, int data, const std::string& spriteName);
 
   void try_break(Player* player);
   HitResponse collision(GameObject& other, const CollisionHit& hit);
index 91b469d..2355fbc 100644 (file)
@@ -421,7 +421,14 @@ Sector::fix_old_tiles()
           add_object(new BonusBlock(pos, tile->getData()));
           solids->change(x, y, 0);
         } else if(tile->getAttributes() & Tile::BRICK) {
-          add_object(new Brick(pos, tile->getData()));
+          if( ( id == 78 ) || ( id == 105 ) ){
+            add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brickIce.sprite") );
+          } else if( ( id == 77 ) || ( id == 104 ) ){
+            add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") );
+          } else {
+            log_warning << "attribute 'brick #t' is not supported for tile-id " << id << std::endl;
+            add_object( new Brick(pos, tile->getData(), "images/objects/bonus_block/brick.sprite") );
+          }
           solids->change(x, y, 0);
         } else if(tile->getAttributes() & Tile::GOAL) {
           std::string sequence = tile->getData() == 0 ? "endsequence" : "stoptux";