Skip to main content
GameDev.net gamedev.net
🔒 Locked

TI-83 Getkey problem

Started by Terrafirma Apr 4, 2007 at 10:44 AM 8 replies 4.7k views
Original Post
Terrafirma
Terrafirma
Can someone help me? I'm programming a game that enables the user to move an avatar about the screen via "Getkey". The problem occurs when the program promts the user to input a direction. The program stops and waits for the input such as with "Input" or "Promt" does. How can I make it so that the user can move at any given time while the other characters in the game move as well? ~~~~~~~~~~ ~Black Opus~ ~~~~~~~~~~
Ravuya
Ravuya
Moving to Consoles, I guess.

I think GetKey blocks. Benryves would know way more about programming the TI-83, though. I think he uses mostly assembly language but probably knows something about basic. If he doesn't show up in the thread, send him a PM.

My TI-83 games (except for my Progress Quest implementation) were all turn-based because I ran into the same problem.
benryves
benryves
(I'm assuming as this is assembly, as _GetKey will wait for a key, whereas the BASIC GetKey - at least on the 83+ - returns 0 for no key, or the keycode if a key is pressed).

Ideally, you should use direct input; that is, talk to the keypad hardware manually. You first need to clear the hardware and then write a mask selecting which keys you wish to retrieve the status of, before reading the hardware and masking out the keys you want.

Here's some documentation on the hardware, along with an example.

Alternatively you could use GetCSC, but this is less flexible (no support for multiple keypresses, for example).
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
Terrafirma
Terrafirma
Unfortunetly I don't use ASM. Thanks for your advice, I will be researching what you said and see if that works better. In the meantime, can someone help me to make a pong game using the BASIC that the TI-83+ provides. is there even a way to move simultaneously with another object on screen using TI-83+ BASICs?
load_bitmap_file
load_bitmap_file
How are you using GetKey? I wrote a Tron clone in TI-BASIC on my TI-84 using it, and it doesn't block for me. Works on TI-83s too, albeit slower.

My code just looks like

getKey->KIf K=24 or K=26 or K=25 or K=34Then...


EDIT:

Quote:
Original post by Terrafirma
In the meantime, can someone help me to make a pong game using the BASIC that the TI-83+ provides. is there even a way to move simultaneously with another object on screen using TI-83+ BASICs?


Well, I've gotten two lines snaking around the screen with TI-BASIC. TI-BASIC is awfully slow, but something like pong is feasible. There isn't really anything special you have to do.
benryves
benryves
If this is an 83+, not an 83, I strongly recommend you look into xLIB; it provides its own GetKey with support for multi-directional cursor key input as well as some great graphics routines.
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
load_bitmap_file
load_bitmap_file
Quote:
Original post by benryves
If this is an 83+, not an 83, I strongly recommend you look into xLIB; it provides its own GetKey with support for multi-directional cursor key input as well as some great graphics routines.


I've lost the urge to fiddle around with my calculator a while ago, but that is extremely neat [wow]
Theamd
Theamd
I don't remember any differences in between BASICs. It's called the TI83-TI84 family because all the calculators are all fundamentally the same, except for a bit more memory here and there, and a different key layout for the older ones.

Last time I used GetKey, I ran into the opposite problems :D
the program wasn't stopping for the user.

I believe the way to make it stop was to do something like this:

GetKey->A
while A = 0
GetKey->A
End
End

so that it looped until it got a real value.

For your implementation, you want to have only 1 Getkey during each step of the game loop, and every time check for an arrow key press or a 0(indicating the player didn't move).

Hope this helps ;)
ShotgunNinja
ShotgunNinja
Heh, this is my best topic.

Well, you could try making a game loop (that's really fricking big), and somewhere in there put the lines:

getKey()→K
If K≠0
Then
prgmDOGETKEY→I
prgmINPTRECV
End

And in the program DOGETKEY:

PROGRAM:DOGETKEY
getKey()→I
If I=24 (Left arrow)
Then
Return "L" (or "L"→Str0 or something)
End
If I=25 (Up arrow)
Then
Return "U" (or "U"→Str0 or something)
End

...

(After all input blocks)
Return

And in the program INPTRECV:

PROGRAM:INPTRECV
If I="U" (or Str0="U", assuming you used Str0)
Then
(Do the walk upward function)
End
If I="L" (or Str0="L")
(Do the left function)

Et cetera.
blackcloak
blackcloak
The Getkey function on the ti-83 is a polling type function you have to keep calling it to capture the key press. You will have to place the function call in a loop. You can ether put it in a game loop or have it in a small loop and use a goto command to jump out of the loop to process the key press (this is a sort of call back funtion type behavior) and then jump back in to the loop and wait for next key press.
Black CloakEpee Engine.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.