4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "invisible_block.hpp"
23 #include "resources.hpp"
24 #include "sprite/sprite.hpp"
25 #include "sprite/sprite_manager.hpp"
26 #include "video/drawing_context.hpp"
27 #include "audio/sound_manager.hpp"
28 #include "object_factory.hpp"
29 #include "object/player.hpp"
31 InvisibleBlock::InvisibleBlock(const Vector& pos)
32 : Block(sprite_manager->create("images/objects/bonus_block/invisibleblock.sprite")), visible(false)
35 sound_manager->preload("sounds/brick.wav");
36 sound_manager->preload("sounds/brick.wav");
40 InvisibleBlock::draw(DrawingContext& context)
43 sprite->draw(context, get_pos(), LAYER_OBJECTS);
47 InvisibleBlock::collision(GameObject& other, const CollisionHit& hit)
50 Player* player = dynamic_cast<Player*> (&other);
52 if(player->get_movement().y > 0 ||
53 player->get_bbox().get_top() <= get_bbox().get_bottom() - 7.0) {
59 return Block::collision(other, hit);
63 InvisibleBlock::hit(Player& )
65 sound_manager->play("sounds/brick.wav");
70 sprite->set_action("empty");
72 set_group(COLGROUP_STATIC);
76 //IMPLEMENT_FACTORY(InvisibleBlock, "invisible_block");