Urgent.News

What's breaking now, across thousands of outlets.

Tech

Define one input action per screen across mouse, touch, and gamepad controls

Pushing a stick right should move the selection once. Treat every event received while the stick remains tilted as “next,” and the selection keeps jumping. Charging an attack, meanwhile, needs both the press and the release. Supporting several input devices requires defining what counts as one action on each screen. This investigation read a fixed version of VOLT NOMAD and tested its gamepad…

Across all input devices, each distinct action should be clearly defined to ensure smooth gameplay. In VOLT NOMAD, a single stick tilt forward moves the selection once, with each increment of movement treated as a new action. Charging an attack requires both the start and end of the action. For mouse and touch controls, the press and release of buttons each count as separate actions.

When it comes to gamepad inputs, each button press is handled individually. Defining these actions on each screen is crucial, particularly when multiple devices are used concurrently.

The investigation focused on the VOLT NOMAD game, specifically examining its gamepad direction conversion and button remapping within the Godot engine. This testing was conducted on a fixed version of the game, not across all supported devices. The code for handling input was reviewed, revealing how shared input settings were initially established and subsequently customized for each screen.

Notably, the handling of dialogue, combat, and other screens needed to be isolated to prevent actions from spilling over into unrelated functions.

The implementation process began by identifying the active screen, then directing events to their respective handlers. An important consideration was ensuring that an action affecting a dialogue screen didn't inadvertently influence combat handling within the same function. The input code meticulously selected screens prior to processing input events. Once an input event was handled, the _unhandled_input() function was called, and execution was halted within the current function.

Godot's InputEvent documentation was referenced to understand how events are delivered and how the handled flag operates. The process of input handling varied slightly depending on the input method: mouse buttons were checked for position on press and release, touch inputs passed the press location to similar operations, and keyboard events were directed to a dedicated handler. Gamepad inputs were also routed to a dedicated handler, with the left stick converted into a single direction before moving the selection.

During testing, synthetic input events were used to verify the behavior of the direction-selection function. This function, extracted from the game's source code, returned a Vector2i direction based on the input event. If the horizontal axis value exceeded 0.45, the direction was set to right or left accordingly, and the latch was cleared when the input value fell below this threshold. This ensured that the selection only moved when the stick moved sufficiently from its neutral position.

The function did not repeat directions while the input was held, maintaining a consistent behavior for repeated input. This check was performed across ten events, including vertical axis inputs that independently triggered actions while the horizontal axis remained latched. The remapping process preserved other input types, ensuring that shared controller settings avoided binding two actions to the same button.

This meticulous process covered various input methods and screen interactions, providing a comprehensive overview of how actions were defined and handled across the game.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Why File Organization Should Be Semantic, Not Filename-Based

If you've ever shipped a search feature, you know the ceiling is set by what you index. Index filenames and your ceiling is human naming quality.

  • Semantic organization indexes file content, not filenames
  • Unstructured data makes folder-based systems ineffective
  • Local-first organization enhances privacy and collaboration

Pocket Grass: Gemma finishes one sentence, then the phone goes away

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass The card is supposed to be the short part.

  • Pocket Grass encourages users to appreciate surroundings before stepping outside.
  • Gemma, an open model, finishes one sentence about user's observation.
  • App works offline, no network connection required after initial download.

How can Europe leverage laws to secure cloud sovereignty?

Europe doesn’t have to choose between acting fast and building a solid foundation for sovereignty.

  • European organizations struggle with balancing cloud adoption and data control.
  • CADA provides clarity on sovereignty but needs consistent standards.
  • Partnerships between local operators and tech firms accelerate European sovereignty.

More from Monday 12 October →