Omnimaga

Calculator Community => Major Community Projects => The Axe Parser Project => Topic started by: ferbplatypult on June 28, 2022, 01:34:59 pm

Title: Handling multiple inputs at once
Post by: ferbplatypult on June 28, 2022, 01:34:59 pm
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?
Title: Re: Handling multiple inputs at once
Post by: Xeda112358 on June 28, 2022, 04:20:56 pm
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: [Select]
If getKey(9)
//Enter is pressed
End

If getKey(1)
//Down is pressed
End

You can also do some useful arithmetic, like if you have (X,Y) coordinates, you might want:
Code: [Select]
X+getKey(3)-getKey(2)→X
Y+getKey(1)-getKey(4)→Y
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! (https://www.omnimaga.org/introduce-yourself!/)
Title: Re: Handling multiple inputs at once
Post by: ferbplatypult on June 28, 2022, 06:39:07 pm
That works amazingly, thank you so much  :)