Thats a bit more challenging ^^'
For using a gamepad: you'd use this script:
viewtopic.php?f=4&t=8749OR! This script in simple:
- Code: Select all
int BTN[15];
double AXIS[2];
void SetupGamePad() {
int i;
for(i=0;i<14;i++){ BTN[i]=GetJoystick1Button(i); } //Allow 15 buttons
AXIS[0]=GetJoystick1Axis(0) //Xaxis of joystick
AXIS[1]=GetJoystick1Axis(1) //Yaxis of joystick
}
Now to use this:
if(AXIS[0]>10000) would mean if the joystick is pressed to the right. Replace ">10000" with <-10000 and it'll mean pressed left, replace AXIS[0] with AXIS[1] and >10000 means pressed down I think, and <-10000 means pressed up.
If you want a script where your not pressing any direction, you'd use this
- Code: Select all
if(AXIS[0]<10000 && AXIS[0]>-10000 && AXIS[1]<10000 && AXIS[1]>-10000) {
//Do Code
}
This means if its not pressed :3