-Some cleanups in text scrolling code
[supertux.git] / src / object / infoblock.cpp
1 #include <config.h>
2
3 #include "infoblock.h"
4 #include "gameloop.h"
5 #include "resources.h"
6 #include "special/sprite_manager.h"
7 #include "object_factory.h"
8 #include "lisp/lisp.h"
9
10 InfoBlock::InfoBlock(const lisp::Lisp& lisp)
11   : Block(sprite_manager->create("bonusblock"))
12 {
13   Vector pos;
14   lisp.get("x", pos.x);
15   lisp.get("y", pos.y);
16   bbox.set_pos(pos);
17
18   if(!lisp.get("message", message)) {
19     std::cerr << "No message in InfoBlock!\n";
20   }
21 }
22
23 InfoBlock::~InfoBlock()
24 {
25 }
26
27 void
28 InfoBlock::hit(Player& )
29 {
30   GameSession::current()->display_info_box(message);
31   start_bounce();
32 }
33
34 IMPLEMENT_FACTORY(InfoBlock, "infoblock")