Make player.gd easier to read for newer programmers #8
Loading…
Reference in a new issue
No description provided.
Delete branch "beginner-readability"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Makes
Characters/player.gdeasier to follow for someone new to programming and Godot, with no behaviour change.Explanations
deltais, normals, tangents, the dot product and raycasts.sqrt(2 × gravity × distance), now its own_get_hop_speed), the exponential smoothing on the sprite's rotation, arc length, and how the wall hop lands at the same height.Formatting
climbedPastWallTop,tryingToLetGo,holdingDown,standingStillandhitHeadOn.if x: ystatements are written out as normal blocks.horizontalInput == 0.0,hit == null,.is_empty().Naming
poscurrentPositionlinejustInsideSurfacestepdistanceThisFramealonginputAlongSurfaceoffsetfromCornerwrapTravelledwrapDistanceTravelledtoAngle/fromAngleparamsarcEndAngle/arcStartAngleLetting go of walls and ceilings now has its own functions (
_update_wall_letting_go,_update_ceiling_letting_go) instead of being buried in the movement steps.Keeps the
# FX resourcesgrouping of the sound and particle nodes from your working copy.Comments trimmed
A second pass shortened the comments and removed ones that just restate the next line, keeping the ones that explain why or non-obvious maths (284 comment lines down to 110). With comments stripped, the code is identical to the first pass.
Testing
test_level.tscnloads and runs.🤖 Generated with Claude Code