changed worldmap format a bit to be more consistent with level format
[supertux.git] / src / object / specialriser.cpp
1 //  $Id$
2 // 
3 //  SuperTux
4 //  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
5 //
6 //  This program is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU General Public License
8 //  as published by the Free Software Foundation; either version 2
9 //  of the License, or (at your option) any later version.
10 //
11 //  This program is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //  GNU General Public License for more details.
15 // 
16 //  You should have received a copy of the GNU General Public License
17 //  along with this program; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 //  02111-1307, USA.
20 #include <config.h>
21
22 #include <math.h>
23 #include "specialriser.h"
24 #include "resources.h"
25 #include "camera.h"
26 #include "sector.h"
27 #include "sprite/sprite_manager.h"
28
29 SpecialRiser::SpecialRiser(MovingObject* _child)
30   : child(_child)
31 {
32   offset = 0;
33 }
34
35 SpecialRiser::~SpecialRiser()
36 {
37 }
38
39 void
40 SpecialRiser::update(float elapsed_time)
41 {
42   offset += 50 * elapsed_time;
43   if(offset > 32) {
44     Sector::current()->add_object(child);
45     remove_me();
46   }
47 }
48
49 void
50 SpecialRiser::draw(DrawingContext& context)
51 {
52   context.push_transform();
53   context.set_translation(
54       context.get_translation() + Vector(0, -32 + offset));
55   child->draw(context);
56   context.pop_transform();
57 }
58