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