What is the best way to do mouse-like controls for gamepad?

0 favourites
  • 4 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • my game is now mouse/keyboard. but I want to support gamepad. UI stuff makes it difficult.

    what is a good way to have gamepad use a mouse-like pointer for the UI?

    currently I have my in-game a mouse pointer sprite that set to the position of mouse.x/y but only if Game_ControlType = "keyboard"

    once the player touches the gamepad, the global var Game_ControlType changes to "gamepad", so I would like a good way to move that pointer around with the gamepad. Any thoughts?

  • I wouldn't normally recommend simulating a mouse with a gamepad, it is very clunky for the user. A more common gamepad system will snap to points of interest, like menu buttons or interactable objects.

    Otherwise if you insist, you'll just want to have an intermediate variable store the position of the simulated pointer. If using mouse/keyboard, set those variables to mouse.x, mouse.y, and set the pointer position to the variables. If using a gamepad, adjust the variable accordingly depending on the input.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • yeah I got this from the Discord:

    Set MousePointer to Self.X+(Gamepad.Axis(0,0)*speed) *and same for Y

    yeah its a ton of work to support both mouse and gamepad the "correct" way. And since I'm mostly targeting mouse/keys I only need the option for gamepad players to not have to pick up a mouse... and for Steam Deck.

  • thanks fedca!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)