Skip to content

Unit layre Update#96

Merged
1brucben merged 2 commits into
v0.2.0from
unitlayer
Nov 18, 2025
Merged

Unit layre Update#96
1brucben merged 2 commits into
v0.2.0from
unitlayer

Conversation

@1brucben
Copy link
Copy Markdown
Owner

This pull request introduces significant improvements to how unit movement is rendered and how input events are handled in the client, focusing on smoother animations and better event consumption. The most important changes are grouped below by theme.

Input Event Handling

  • The MouseUpEvent now includes a consumed flag to indicate if the event has already been handled by a layer, preventing duplicate processing. The main game runner and UnitLayer both respect this flag to ensure clicks are only processed once, improving interaction reliability. [1] [2] [3] [4] [5]

Unit Animation and Rendering

  • Added interpolation logic for unit movement between game ticks. This includes new methods and state in UnitLayer to compute and render interpolated positions for selected unit types, resulting in much smoother animations. [1] [2] [3] [4] [5] [6] [7]
  • Created a dedicated interpolation canvas and context for rendering interpolated units, ensuring separation from other rendering layers. (src/client/graphics/layers/UnitLayer.tsR45-R46, F787aa55L331R331)

Replay Speed Support

  • Integrated replay speed multiplier handling in UnitLayer, allowing animation speed to adapt to replay controls. This includes event listening and tick interval adjustment. [1] [2] [3]

Unit Selection and Click Consumption

  • When a unit is selected via click, the event is marked as consumed so other handlers (such as attack logic) do not process the same click, preventing unintended actions.

Code Organization and Refactoring

  • Refactored sprite drawing logic into a new drawSpriteAtPosition method, centralizing rendering details and supporting both interpolated and standard rendering flows.

These changes collectively provide smoother unit movement, more robust input handling, and improved replay experience.

@1brucben 1brucben merged commit 7eec762 into v0.2.0 Nov 18, 2025
5 of 7 checks passed
@El-Magico777 El-Magico777 added this to the v0.1.11 milestone Feb 22, 2026
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.

2 participants