-Some cleanups in text scrolling code
[supertux.git] / src / object / invisible_block.cpp
1 #include <config.h>
2
3 #include "invisible_block.h"
4 #include "resources.h"
5 #include "special/sprite.h"
6 #include "special/sprite_manager.h"
7 #include "video/drawing_context.h"
8 #include "object_factory.h"
9
10 InvisibleBlock::InvisibleBlock(const Vector& pos)
11   : Block(sprite_manager->create("invisibleblock")), visible(false)
12 {
13   bbox.set_pos(pos);
14   flags &= ~FLAG_SOLID;
15 }
16
17 void
18 InvisibleBlock::draw(DrawingContext& context)
19 {
20   if(visible)
21     sprite->draw(context, get_pos(), LAYER_OBJECTS);
22 }
23
24 void
25 InvisibleBlock::hit(Player& )
26 {
27   if(visible)
28     return;
29
30   sprite->set_action("empty");
31   SoundManager::get()->play_sound(IDToSound(SND_BRICK));
32   start_bounce();
33   flags |= FLAG_SOLID;
34   visible = true;
35 }
36
37 //IMPLEMENT_FACTORY(InvisibleBlock, "invisible_block");