1
0
Fork
You've already forked ghost-game
0

add follow-mouse movement #6

Merged
jfml merged 5 commits from follow-mouse-movement into main 2026年06月27日 19:02:25 +02:00
Collaborator
Copy link

Changes:

  • Add new feature to have player move towards the mouse cursor when mouse button is held
  • Some tweaks to how the touchscreen action button works to avoid inputs triggering multiple times
    • Add a Control node under the button to swallow the emulated mouse events
    • Have it trigger 'interact' rather than 'ui_accept'
  • Rename a few internal bits of Player to make it easier to reference the player sprite

Testing:

  • Checked on mobile and desktop

Future ideas:

  • Add an option to let players choose between virtual joystick vs touch-to-move
  • Add pathfinding navigation ("click to go here" rather than "click-and-hold to follow")
  • Add some kind of visual indicator around/above interactable objects
  • Allow clicking on actionables to interact with them
Changes: - Add new feature to have player move towards the mouse cursor when mouse button is held - Some tweaks to how the touchscreen action button works to avoid inputs triggering multiple times - Add a Control node under the button to swallow the emulated mouse events - Have it trigger 'interact' rather than 'ui_accept' - Rename a few internal bits of Player to make it easier to reference the player sprite Testing: - Checked on mobile and desktop Future ideas: - Add an option to let players choose between virtual joystick vs touch-to-move - Add pathfinding navigation ("click to go here" rather than "click-and-hold to follow") - Add some kind of visual indicator around/above interactable objects - Allow clicking on actionables to interact with them
With this, the player can click and have the ghost move towards their
mouse cursor. Next steps: "click to move" with pathfinding?
Turns out when you tap a touch button (or click it on desktop) there are
several input events generated. This means _unhandled_input gets called
multiple times in the same frame and we open multiple dialogue windows.
Touch buttons aren't Control nodes, so clicking on the interact button
was also triggering the default mouse click behaviour (i.e.
move-to-mouse movement).
Have added a basic control node in the button to capture those events.
(That's probably a sign that this touch button should just be a regular
button, but real buttons lack the convenience of the 'action' property.)
Owner
Copy link

Exciting and amazing! ^__^

Exciting and amazing! ^__^
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jfml/ghost-game!6
Reference in a new issue
jfml/ghost-game
No description provided.
Delete branch "follow-mouse-movement"

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?