Skip to content

Commit

Permalink
When creating a brick object to handle tiles with attribute brick the…
Browse files Browse the repository at this point in the history
… iced image is used for icy variant of the tiles (ID 78 and 105).
  • Loading branch information
uafr authored and tobbi committed Oct 26, 2013
1 parent 927a356 commit f7b9ecc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions data/images/objects/bonus_block/brickIce.sprite
@@ -0,0 +1,8 @@
(supertux-sprite
(action
(name "empty")
(images "empty.png"))
(action
(name "normal")
(images "../../tiles/blocks/brick1.png"))
)
4 changes: 2 additions & 2 deletions src/object/brick.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/object/brick.hpp
Expand Up @@ -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);
Expand Down
9 changes: 8 additions & 1 deletion src/supertux/sector.cpp
Expand Up @@ -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";
Expand Down

0 comments on commit f7b9ecc

Please sign in to comment.