• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Joystick (Windows and Ubuntu)

Hiya.

I'm trying to get a simple arcade joystick with a few buttons working in a game. I first need it in Windows and later preferably exported to Ubuntu. Windows detecs the joystick just fine and I can trace on a test website.

I've been trying to use joystick_xpos() to trace my joystick in the game, but I get the "unknown function or script..." error line, which makes sense after I found a post saying that the function is obsolete. I cannot find other functions than the ones I also found was claimed to be obsolete.

So how do I trace my joystick in GM2? Do I need to treat it as a gamepad instead?

Thanks in advance,
Peter
 
Alright, so right after typing this, I solved it (tada, typing makes you think). To other people with a similar problem, here's what works (at least for me):

The joystick registeres as a gamepad with the id 4 (and probably 5 for a second joystick). So the following traces horizontal movement from -1 to 1:
Code:
gamepad_axis_value(4, gp_axislh);
 
Top