From 4ead43b044241f2c757526223c4d9fbb2f814c4c Mon Sep 17 00:00:00 2001 From: bruhmoent Date: Sat, 13 Jul 2024 12:01:08 +0200 Subject: [PATCH] Fix? --- src/object/player.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/object/player.cpp b/src/object/player.cpp index 55e82530ed0..d90b646541b 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -2445,7 +2445,7 @@ Player::on_flip(float height) { Vector pos = get_pos(); pos.y = height - pos.y - get_bbox().get_height(); - set_pos(pos); + set_pos_reset(pos); } void @@ -2558,6 +2558,17 @@ Player::set_pos(const Vector& vector) { MovingObject::set_pos(vector); + // Make sure objects following Tux move directly with him + position_grabbed_object(true); + for (Key* key : m_collected_keys) + key->update_pos(); +} + +void +Player::set_pos_reset(const Vector& vector) +{ + m_col.set_pos(vector); + // Reset size to get correct hitbox if Tux was eg. ducked before moving if (is_big()) m_col.set_size(TUX_WIDTH, BIG_TUX_HEIGHT); @@ -3068,7 +3079,7 @@ Player::multiplayer_respawn() set_group(COLGROUP_MOVING); m_physic.reset(); - set_pos(target->get_pos()); + set_pos_reset(target->get_pos()); m_target.reset(); }