Gamepad Values Problem

Discussion in 'Programming' started by Imperial, Mar 15, 2019 at 2:27 PM.

  1. Imperial

    Imperial Member

    Joined:
    Jun 29, 2016
    Posts:
    123
    Hello

    so this is my script
    Code:
    Key_Vertical = gamepad_axis_value(global.gamepad_index,gp_axisrv);
    when I print the Key_Vertical variable It only returns 0 and 1

    and It should return -1 and 0 and 1

    How to Fix this please
     
  2. Taddio

    Taddio Member

    Joined:
    Nov 16, 2018
    Posts:
    289
    It actually should return ANYTHIBG BETWEEN -1 and 1, depending on how far you pushed your joystick.
    Are you sure global.gamepad_index refers to 0 (controller 1)?
    To my eyes, your bit of code should work...
     
  3. Imperial

    Imperial Member

    Joined:
    Jun 29, 2016
    Posts:
    123
    Code:
    for(i = 0; i < gamepad_get_device_count(); i++)
    {
        if(gamepad_is_connected(i))
        {
            global.gamepad_index = i;
        }
    }
     
  4. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,236
    Did you test your controller in other programs to make sure it's not broken?
    What did you set the threshold to for your controller in Game Maker? Did you set a threshold?
    Are you sure you pushed UP on the right analog and DOWN on the right analog?
    Are you sure the constant in GM is not pointing to the wrong input on your controller?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice