feat(classic-games): 新增 Mini Sea Wolf 小游戏#767
Conversation
Made-with: Cursor
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f91e1ddf3c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ships.forEach((ship) => { | ||
| if (torpedo.hit) return; |
There was a problem hiding this comment.
Skip ships already marked hit before awarding sinks
When two torpedoes overlap the same ship in the same animation frame, the first torpedo sets ship.hit, but the ship remains in ships until after the outer loop. Later torpedoes still pass this check and run score += ship.points/sunk += 1, so one ship can count as multiple kills and finish the 8-sink objective early; ignore ship.hit inside this loop or remove the ship immediately.
Useful? React with 👍 / 👎.
| document.getElementById("leftBtn").addEventListener("pointerdown", () => keys.add("ArrowLeft")); | ||
| document.getElementById("leftBtn").addEventListener("pointerup", () => keys.delete("ArrowLeft")); | ||
| document.getElementById("rightBtn").addEventListener("pointerdown", () => keys.add("ArrowRight")); | ||
| document.getElementById("rightBtn").addEventListener("pointerup", () => keys.delete("ArrowRight")); |
There was a problem hiding this comment.
Clear movement state on lost pointer releases
When the player presses a movement button and releases after dragging outside the button, or the pointer is canceled, these button-scoped pointerup handlers do not run, leaving ArrowLeft/ArrowRight in keys. Because updateScope() reads that set every frame, the scope keeps moving by itself until the same direction is pressed and released again; use pointer capture or document-level pointerup/pointercancel cleanup.
Useful? React with 👍 / 👎.
Summary
project/classic-games/20260703-1744-sea-wolf.htmlproject/classic-games/历史产物重复Validation
<!doctype html>与</html>结构https://cdn.tailwindcss.comnew Function(...)解析检查git diff --check通过Audit
OVERALL_EXIT=0AUDIT_DIR=/tmp/git-commit-audit-20260703-174752-18958Remote
mainatf5ba84844397901a59c6cd2c18f930a09c807230codex/classic-game-20260703-1744-sea-wolff91e1ddf3c8fa2161830b2bc3da4745f547d359b