added jam build system, please try it out - the advantage would be that it already...
[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
9 InvisibleBlock::InvisibleBlock(const Vector& pos)
10   : Block(pos, sprite_manager->create("invisibleblock")), visible(false)
11 {
12   flags &= ~FLAG_SOLID;
13 }
14
15 void
16 InvisibleBlock::draw(DrawingContext& context)
17 {
18   if(visible)
19     sprite->draw(context, get_pos(), LAYER_OBJECTS);
20 }
21
22 void
23 InvisibleBlock::hit(Player& )
24 {
25   if(visible)
26     return;
27
28   sprite->set_action("empty");
29   SoundManager::get()->play_sound(IDToSound(SND_BRICK));
30   start_bounce();
31   flags |= FLAG_SOLID;
32   visible = true;
33 }
34