Calculator Community > The Axe Parser Project

Handling multiple inputs at once

(1/1)

ferbplatypult:
I’m making a wild guns remake for my ti-84 with axe and I’m wondering if it’s possible to receive multiple inputs like holding a button while moving a cursor. I feel like he answer may lie In the getkeyS command but I can’t get it to work properly. Does anyone know how to do it?

Xeda112358:
You were on the right track-- "getKey" on its own returns a single keypress, but you can also use "getKey(n)" to check if key "n" is pressed (it returns 0 for not pressed, 1 for pressed).

So if you want to check for both Enter and the Down arrow, simultaneously:

--- Code: ---If getKey(9)
//Enter is pressed
End

If getKey(1)
//Down is pressed
End

--- End code ---

You can also do some useful arithmetic, like if you have (X,Y) coordinates, you might want:

--- Code: ---X+getKey(3)-getKey(2)→X
Y+getKey(1)-getKey(4)→Y

--- End code ---
And that has a bonus of letting the user press multiple arrow keys simultaneously :)

Hopefully that helps!

EDIT: Also, welcome to Omninaga, you should Introduce Yourself!

ferbplatypult:
That works amazingly, thank you so much  :)

Navigation

[0] Message Index

Go to full version