Page 1 of 1

Joypad problem

PostPosted: Fri Jun 17, 2011 12:34 pm
by Jagmaster
I'm having trouble with Joypad input.

Code: Select all
A=GetJoystickButton[0];

if(A==1&&canjump==1&&canpress==1)
{
jump
canjump=0;
canpress=0;
}


The player keeps jumping. It's as if I have keydown set to repeat. :?
How do I tell it to only jump when I tap the button ?

Re: Joypad problem

PostPosted: Fri Jun 17, 2011 3:56 pm
by Hblade
theres are quite confusing to fix XD Try this
code:
Code: Select all
if (A==1) {
switch(canjump) {
case 0: canpress=0;
break;
case 1:
    if (canpress==1) {
   //do jump code
    canjump=0;
                            }
break;
}
}


That code might have a few bugs in it, but thats because it was untested and I didn't even open GE :P

that should work though.

Re: Joypad problem

PostPosted: Sat Jun 18, 2011 9:16 pm
by lcl
Jagmaster wrote:I'm having trouble with Joypad input.

Code: Select all
A=GetJoystickButton[0];

if(A==1&&canjump==1&&canpress==1)
{
jump
canjump=0;
canpress=0;
}


The player keeps jumping. It's as if I have keydown set to repeat. :?
How do I tell it to only jump when I tap the button ?

Your code seems to be alright, it sets canpress and canjump to 0, so it shouldn't repeat.
So, this code is not the problem. Go and check what is the value of the canjump variable during the game. Create a text actor, and make it show the canjump value. I'm pretty sure there is something making canjump equal to 1 even when it shouldn't.

Tell me what you find out! :)