对于一个实验,我决定使用内置的程序编辑器将一个小游戏编程到我的TI-89中,但是我无法找到一种在没有明显延迟的情况下获得击键的最佳方法.目前我有:
Prgm
70?xpos
70?ypos
Loop
If getKey()=340 Then
xpos+3?xpos
PxlCrcl ypos,xpos,5,1
EndIf
If getKey()=337 Then
xpos-3?xpos
PxlCrcl ypos,xpos,5,1
EndIf
If getKey()=257 Then
Goto end
EndIf
EndLoop
Lbl end
EndPrgm
Run Code Online (Sandbox Code Playgroud)
这会创建一个无限的游戏循环,检查是否按下了左,右或删除按钮并相应地向左或向右绘制一个圆圈或完全结束程序.然而,这种方法似乎运行得非常缓慢,我在其他演示中看到了更平稳的运动.我的方法有问题吗?如果有,我怎样才能改进它?