24
24
#include " supertux/game_session.hpp"
25
25
#include " supertux/screen_manager.hpp"
26
26
#include " supertux/sector.hpp"
27
+ #include " supertux/flip_level_transformer.hpp"
27
28
#include " util/reader_mapping.hpp"
28
29
29
30
Door::Door (const ReaderMapping& mapping) :
@@ -33,7 +34,8 @@ Door::Door(const ReaderMapping& mapping) :
33
34
target_spawnpoint(),
34
35
script(),
35
36
sprite(SpriteManager::current()->create(" images/objects/door/door.sprite" )),
36
- stay_open_timer()
37
+ stay_open_timer(),
38
+ m_flip(NO_FLIP)
37
39
{
38
40
mapping.get (" x" , m_col.m_bbox .get_left ());
39
41
mapping.get (" y" , m_col.m_bbox .get_top ());
@@ -55,7 +57,8 @@ Door::Door(int x, int y, const std::string& sector, const std::string& spawnpoin
55
57
target_spawnpoint(spawnpoint),
56
58
script(),
57
59
sprite(SpriteManager::current()->create(" images/objects/door/door.sprite" )),
58
- stay_open_timer()
60
+ stay_open_timer(),
61
+ m_flip(NO_FLIP)
59
62
{
60
63
m_col.m_bbox .set_pos (Vector (static_cast <float >(x), static_cast <float >(y)));
61
64
@@ -117,7 +120,7 @@ Door::update(float )
117
120
void
118
121
Door::draw (DrawingContext& context)
119
122
{
120
- sprite->draw (context.color (), m_col.m_bbox .p1 (), LAYER_BACKGROUNDTILES+1 );
123
+ sprite->draw (context.color (), m_col.m_bbox .p1 (), LAYER_BACKGROUNDTILES+1 , m_flip );
121
124
}
122
125
123
126
void
@@ -179,4 +182,11 @@ Door::collision(GameObject& other, const CollisionHit& hit_)
179
182
return TriggerBase::collision (other, hit_);
180
183
}
181
184
185
+ void
186
+ Door::on_flip (float height)
187
+ {
188
+ MovingObject::on_flip (height);
189
+ FlipLevelTransformer::transform_flip (m_flip);
190
+ }
191
+
182
192
/* EOF */
0 commit comments