Skip to content

Fix heavy coins ignoring water physics (Closes #3729)#3771

Open
franciscogfsm wants to merge 1 commit intoSuperTux:masterfrom
franciscogfsm:fix/heavy-coin-water-physics
Open

Fix heavy coins ignoring water physics (Closes #3729)#3771
franciscogfsm wants to merge 1 commit intoSuperTux:masterfrom
franciscogfsm:fix/heavy-coin-water-physics

Conversation

@franciscogfsm
Copy link
Copy Markdown

Fix #3729: Heavy coins not affected by water physics

Heavy coins (and coins dropped by killed enemies) were not applying
water physics when falling into water, causing them to sink straight
to the bottom at full speed instead of floating like other objects.

Fixed by adding a per-frame water tile check in HeavyCoin::update().
When the coin is detected inside a water tile:

  • Gravity modifier is reduced to 0.1
  • Downward velocity is capped at 100

This matches the floaty behaviour of other physics objects such as
rocks and enemies. Named constants are used for both water physics
values to avoid magic numbers.

Tested manually by dropping heavy coins and enemy-dropped coins into
water both now float as expected. Automated tests have also been
implemented covering the fix.

Closes #3729

Heavy coins (and coins dropped by killed enemies) were not applying
water physics when falling into water, causing them to sink straight
to the bottom at full speed instead of becoming floaty.
Fixed by adding a per-frame water tile check in HeavyCoin::update().
When the coin is detected inside a water tile, the gravity modifier is
reduced to 0.1 and the downward velocity is capped at 100, matching
the floaty behaviour of other physics objects like rocks and enemies.

Use named constants for water physics values

Testing Implemented for the Bug Fix
@swagtoy
Copy link
Copy Markdown
Member

swagtoy commented Apr 7, 2026

Hello, just curious which AI model you used for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Coin gravity not affected by water

2 participants