Easter Egg Demo Level:
[supertux.git] / src / object / specialriser.cpp
1 #include <config.h>
2
3 #include <math.h>
4 #include "specialriser.h"
5 #include "defines.h"
6 #include "resources.h"
7 #include "camera.h"
8 #include "sector.h"
9 #include "app/globals.h"
10 #include "special/sprite_manager.h"
11
12 SpecialRiser::SpecialRiser(MovingObject* _child)
13   : child(_child)
14 {
15   offset = 0;
16 }
17
18 SpecialRiser::~SpecialRiser()
19 {
20 }
21
22 void
23 SpecialRiser::action(float elapsed_time)
24 {
25   offset += 50 * elapsed_time;
26   if(offset > 32) {
27     Sector::current()->add_object(child);
28     remove_me();
29   }
30 }
31
32 void
33 SpecialRiser::draw(DrawingContext& context)
34 {
35   context.push_transform();
36   context.set_translation(
37       context.get_translation() + Vector(0, -32 + offset));
38   child->draw(context);
39   context.pop_transform();
40 }
41