1. Hey! Guest! The 33rd GMC Jam will take place between May 23rd, 12:00 UTC (Friday noon) and May 27th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

Gamepad Values Problem

Discussion in 'Programming' started by Imperial, Mar 15, 2019.

  1. Imperial

    Imperial Member

    Joined:
    Jun 29, 2016
    Posts:
    127
    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:
    463
    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:
    127
    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,514
    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