Trail particles behind moving ball projectiles - #127
Merged
Conversation
Fireballs, iceballs and gold fireballs flew across the screen as a bare sprite, with particles only ever showing up at the very end, when the ball burst. They now leave a trail behind them for as long as they are moving. The trail is spread over the path the ball travelled during the tick rather than dropped in a single burst at its current position, since a thrown ball covers over a block per tick and would otherwise leave a dotted line. It is spawned client-side only, where particles exist in the first place, and a ball that is not moving emits nothing. Each ball picks its own particle: embers for the fireball, snowflakes for the iceball and sparkles for the gold fireball. Balls that want no trail at all can leave `getTrailParticle` returning null. Resolves #125 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQFygNg1DQAHDTWbpnVPAZ
The trail was far too dense: up to eight particles per tick, and the faster the ball went the thicker it got. It now follows what vanilla arrows do — a couple of particles strung along the movement of the tick, pushed back the way the ball came so they fall behind it — and the count no longer grows with speed: a fast ball spaces its trail out instead of spawning more of it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQFygNg1DQAHDTWbpnVPAZ
One particle per tick rather than two, and the backwards push they get is now a twentieth of the speed of the ball instead of all of it, which was fast enough to fling the trail off rather than leave it hanging behind. The lone particle of a tick sits halfway along the movement rather than right at its start, so the trail stays centred on the path of the ball. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQFygNg1DQAHDTWbpnVPAZ
The trail was offset by half the bounding box, which put it at the top of the ball rather than at its middle: unlike most entities, a ball is rendered centred on its position instead of standing on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YQFygNg1DQAHDTWbpnVPAZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fireballs, iceballs and gold fireballs used to fly across the screen as a bare sprite: particles only ever showed up at the very end, when the ball burst. They now leave a trail behind them for as long as they are moving.
Resolves #125
Changes
BallgainedgetTrailParticle(), returningnullby default for a ball that leaves no trail, and spawns that particle fromtick(), client-side only.Testing
The particles themselves are client-only visuals, which neither the unit tests (no world) nor the game tests (headless server) can observe. The maths behind them is testable on its own, so
Ball.trailParticleCount(double)is covered by a newBallTrailTest: a motionless ball trails nothing, a moving one always trails something, and going faster spaces the trail out rather than thickening it../gradlew :mubble-test:test # whole unit suite green ./gradlew :mubble-super_mario:compileJava :mubble-core:compileClientJava :mubble-super_mario:compileClientJavaI agree to the Contributor License Agreement found in
CONTRIBUTING.md.🤖 Generated with Claude Code
https://claude.ai/code/session_01YQFygNg1DQAHDTWbpnVPAZ