Skip to content

Commit 9644491

Browse files
committed
player: position grabbed object correctly when flipping
fixes #3696
1 parent be101d0 commit 9644491

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/object/player.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2496,6 +2496,8 @@ Player::on_flip(float height)
24962496
Vector pos = get_pos();
24972497
pos.y = height - pos.y - get_bbox().get_height();
24982498
set_pos_reset(pos);
2499+
2500+
position_grabbed_object(true);
24992501
}
25002502

25012503
void

src/supertux/moving_object.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <simplesquirrel/vm.hpp>
2121

2222
#include "editor/resize_marker.hpp"
23+
#include "object/portable.hpp"
2324
#include "supertux/sector.hpp"
2425
#include "util/reader_mapping.hpp"
2526
#include "util/writer.hpp"
@@ -101,6 +102,11 @@ MovingObject::editor_select()
101102
void
102103
MovingObject::on_flip(float height)
103104
{
105+
auto portable = dynamic_cast<Portable*>(this);
106+
if (portable && portable->is_grabbed())
107+
// The positioning of the grabbed object shall be handled by the player.
108+
return;
109+
104110
Vector pos = get_pos();
105111
pos.y = height - pos.y - get_bbox().get_height();
106112
set_pos(pos);

0 commit comments

Comments
 (0)