Repository navigation
feat: Implement Render System, Projectile Rotation, and Trajectory Visuals (#91) - #185
Merged
Vallykrie merged 3 commits intoMay 18, 2026
Conversation
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.
**What
This PR implements the core visual synchronization and rendering systems required by the ECS architecture, fulfilling Issue #91 and its sub-tasks (#94, #97).
RenderSystem: Synchronizes all entitySpriteComponentnode positions to their underlying logicalTransformComponentposition.xScaleofPlayerEntitynodes automatically so players face the correct direction (player.facing).zRotationof theProjectileEntityto align with its trajectory based on itsVelocityComponentusingatan2.SKEmitterNodeparticle trail that follows the bread/toaster during flight.TrajectoryRenderSystem: Ensured the trajectory arc renders as a dashed/dotted line (dashingWithPhase) and cleanly clears itself when exitingAimState.AnimationSystem: Centralized animation loop cleanly processes and drains all queuedSKActions per frame.Why
TransformComponent, and theRenderSystemcleanly maps that data to SpriteKit at the end of the frame.How
RenderSystem.update()is called at the very end ofGameScene.update(). It extractsTransformComponentandSpriteComponentto update.position.atan2(velocity.dy, velocity.dx)to calculate the continuous angle of flight for any entity with aVelocityComponent.CGMutablePathhandling inTrajectoryRenderSystemto use.copy(dashingWithPhase: 0, lengths: [10.0, 10.0])before assigning it to theSKShapeNode.SKEmitterNodedirectly inProjectileEntity's initialization, utilizing a fallback white particle config since we don't have an.sksasset yet.Notes
SKEmitterNodetrail currently uses a programmatic fallback (white squares). If we add a dedicatedspark.pngorBreadTrail.sksto ourAssets.xcassetslater, this code will automatically pick it up and look even better.