Hi!
I have one small question. How to write the condition simultaneously pressing two buttons "A" and "left"? Maybe my question is stupid, but I tried different options ... simple is not working is not one!
uint16_t oldpadstate,padstate;
//...in some input func
oldpadstate = padstate;
padstate = ReadJoypad(0);
if(padstate & (BTN_A|BTN_B))//A and B pressed this frame?
TriggerFx(10,255,true);
if((padstate & BTN_X) && !(oldpadstate & BTN_X))//pushed this frame but not last?
Triggerx(2,255,true);
I think most people are doing something like this too; using a variable to keep track of the buttons from last frame and the current joypad state of this frame instead of calling the function every time you want to check a button
previous = current;
current = ReadJoypad(0);
held = current & previous;
pressed = current & (current ^ previous);
released = previous & (current ^ previous);
It sorts out pressed, held, released events so one can simply check for combinations afterwards.
previous = current;
current = ReadJoypad(0);
held = current & previous;
pressed = current & (current ^ previous);
released = previous & (current ^ previous);
It sorts out pressed, held, released events so one can simply check for combinations afterwards.