How do I turn sprites into buttons that can be selected with a controller?

Not favoritedFavorited Favorited 1 favourites
  • 4 posts
From the Asset Store
Small pixel icons for the 3 most popular controller types.
  • I've created my main and in-game menus, and I can navigate them using the mouse with hover and click functionality. Now, I'd like to enable selection and interaction using a controller. How can I achieve this?

    Thank you!

  • Hi i might be talking out of knowledge, as might be a easier solution.

    But from top of my head, how i remember controller menus being done, is you have to take the inputs and lock the positions of a menu.

    for example on start of layout you have no input from the controller.

    then u prexx XYZ whatever on ur controler to get to main menu

    and there you should have a boolean that checks that user is using controler.

    if is controller then

    everytick check what user is pushing/pressing

    basically if i move up down on controller, then the menu items should turn "on/off"

    this can be easily be done by event coding.

    for example id do this with 2 global variables:

    1st) isController? YES/1 - NO/0

    2nd) menuIdState = 0

    lets pressume we have 5 menu items,

    (bellow items would be sprites with localvariables on them calling it "orderActive" = 0,1,2,3,4,5 etc)

    Continue Campaign = 1

    Start New Campaign = 2

    Options = 3

    Credits = 4

    Quit = 5

    then in events i would check for each sprite button above if the "orderActive" they have = with "menuIdState" which changes whenever i move up or down on controller.

    So if "up" was pressed on controller, i would set "menuIdState" to menuIdState - 1

    if the "down" was pressed on controller, i would set "menuIdState" to menuIdState + 1

    then on X press to select lets say

    i would check if Sprite.orderActive = "menuIdState" (any from list above) then go to screen layout etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've created my main and in-game menus, and I can navigate them using the mouse with hover and click functionality. Now, I'd like to enable selection and interaction using a controller. How can I achieve this?

    Thank you!

    here is a example using keyboard u just need to swap the inputs of keyboard with the controller ones.

    i added also the controller/gamepad function now if the controller is connected will disable keyboard and if gamepad disconnected keyboard is active.

    might need some adjustments for gamepad inputs as i dont have one and not sure if will work properly. hope it helps.

    drive.google.com/file/d/1Gd6ocwDnS_hNcgZQYkUvI-9kkYge2XZX/view

  • > I've created my main and in-game menus, and I can navigate them using the mouse with hover and click functionality. Now, I'd like to enable selection and interaction using a controller. How can I achieve this?

    >

    > Thank you!

    >

    >

    here is a example using keyboard u just need to swap the inputs of keyboard with the controller ones.

    i added also the controller/gamepad function now if the controller is connected will disable keyboard and if gamepad disconnected keyboard is active.

    might need some adjustments for gamepad inputs as i dont have one and not sure if will work properly. hope it helps.

    https://drive.google.com/file/d/1Gd6ocwDnS_hNcgZQYkUvI-9kkYge2XZX/view?usp=sharing

    Thank you so much, this was exactly what I needed! I really appreciate your detailed explanation and the example project <3

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