Skip to content

fix: add pointer drag input for mobile Nadion movement#11

Closed
penta2himajin wants to merge 3 commits into
masterfrom
claude/fix-nadion-mobile-swipe-onWEP
Closed

fix: add pointer drag input for mobile Nadion movement#11
penta2himajin wants to merge 3 commits into
masterfrom
claude/fix-nadion-mobile-swipe-onWEP

Conversation

@penta2himajin

Copy link
Copy Markdown
Owner

Summary

  • Nadion Defense relied solely on keyboard input (arrow keys/WASD) for horizontal player movement, making it unplayable on mobile
  • Added pointerdown/pointermove/pointerup handlers that track drag delta and update playerX accordingly
  • On touch start, records the initial pointer X and player X; on drag, computes the offset and moves the player proportionally

Test plan

  • All 443 unit tests pass
  • Open Nadion Defense on a mobile device/emulator and verify left/right swipe moves the player
  • Verify tapping still fires nadion bolts
  • Verify keyboard input still works on desktop

https://claude.ai/code/session_01E3YmRJq8E9Exez929AjQH3

On mobile devices, the player had no way to move the Nadion
horizontally since movement relied solely on keyboard input.
Add pointerdown/pointermove/pointerup handlers that track
drag delta and update playerX accordingly.

https://claude.ai/code/session_01E3YmRJq8E9Exez929AjQH3
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 24, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
solidion 5f39573 Commit Preview URL

Branch Preview URL
Mar 24 2026, 04:10 PM

claude added 2 commits March 24, 2026 15:31
Replace the drag-state-based approach with the simpler breakout
pattern: on pointermove, if pointer.isDown, set playerX directly
to pointer.x. The previous approach failed because pointerDragging
was never set to true when the game-start tap returned early.

https://claude.ai/code/session_01E3YmRJq8E9Exez929AjQH3
Instead of snapping directly to pointer position, set a touch
target on pointerdown/pointermove and move toward it at
PLAYER_SPEED (300 px/s) in the game loop — same speed as
keyboard input. Pointer up clears the target. Tap also fires.

https://claude.ai/code/session_01E3YmRJq8E9Exez929AjQH3
@penta2himajin penta2himajin deleted the claude/fix-nadion-mobile-swipe-onWEP branch March 25, 2026 03:42
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