Ironrind Posted February 12, 2010 Report Share Posted February 12, 2010 I've been having trouble with programming a joystick for some time. What I want to do is create a code that will recognize if the the joystick button has been pressed since the last frame or not. Reason is, the insta-shield is executing as soon as the the player jumps. If the player is still holding jump after jumping, I want the jump button to have to be presses again to execute the instashield. Also, I have the same problem for joystick 'key released' rather than 'not being pressed'. I'm using Damizean and McDizzy's Sonic 360 Engine Any ideas/techniques? Link to comment Share on other sites More sharing options...
justin123 Posted February 13, 2010 Report Share Posted February 13, 2010 try this: Begin Step: global.gamepad_button=input function; too lazy to look it up global.gamepad_button_pressed=0; global.gamepad_button_released=0; if global.gamepad_button { if global.gamepad_button_pressed{global.gamepad_button_pressed=0 button_not_active=1}; } else { global.gamepad_button_pressed=0; button_not_active=0; } if global.gamepad_button_pressed && !gamepad_button {global.gamepad_button_released=true;} EDIT: if your using gm7+, download tahnok's "gamepad extended" extention. It has the functions you need. 1 Link to comment Share on other sites More sharing options...
FanGameRevolver Posted February 13, 2010 Report Share Posted February 13, 2010 This thread is pretty useful for using joystick support. http://gmc.yoyogames.com/lofiversion/index.php/t22469.html 1 Link to comment Share on other sites More sharing options...
Ironrind Posted February 13, 2010 Author Report Share Posted February 13, 2010 Thanks guys! I got it working just fine. Joystick/Gamepads are so much more comfortable. Rep++ Link to comment Share on other sites More sharing options...
Godmaster Posted February 13, 2010 Report Share Posted February 13, 2010 It's possible to remap joystick buttons in GM? Would like a good idea for different kinds of joypads. Link to comment Share on other sites More sharing options...
Ironrind Posted February 13, 2010 Author Report Share Posted February 13, 2010 Yeah, that's pretty sweet. Now I want experiment with acceleration based on the degree that you move the joystick. May have to change things up a bit. Link to comment Share on other sites More sharing options...
justin123 Posted February 16, 2010 Report Share Posted February 16, 2010 Yeah, that's pretty sweet. Now I want experiment with acceleration based on the degree that you move the joystick. May have to change things up a bit. That pretty easy. In my game I did this in the step event: max_x_speed=24*abs(joystick_xpos(1)); Link to comment Share on other sites More sharing options...
Ironrind Posted February 16, 2010 Author Report Share Posted February 16, 2010 For some reason, I thought it'd be sort of tricky. Thanks for the help and this works pretty good too for acceleration: hsp+=acc*abs(joystick_xpos(1)) Link to comment Share on other sites More sharing options...
Recommended Posts