擊鍵對於那些經典遊戲 ...你可以使用鍵盤!

// mouseBox has some keyboard methods that have not been// documented very well. Test them to see if they will// do what you need; there are issues with the mouse box// losing key focus and issues with special keys (like "s")// that enter selection-cursor mode and lose the key focus.// it looks like the numeric keypad and the arrow keys work // pretty well.New Window( "test", mb = MouseBox( tb = Text Box( "try the arrow keys" ) ) );mb << setkey( Function( {this, key}, tb << settext( key ) ) );mb << setkeyenable( 1 );mb << setfocus;這可以回到JMP 11。 這裡的反饋會很棒。
回复:擊鍵謝謝Craige分享...... 這肯定會提高我的高分。
我發布了一個新版本蛇使用此setkey函數設置我的“下一個方向”變量,它似乎運行良好
//啟用鍵盤控件
mb << setkey(
功能({this,key},
如果(key ==“DOWN”,:: nextdir = 1);
如果(key ==“LEFT”,:: nextdir = 2);
如果(key ==“UP”,:: nextdir = 3);
如果(key ==“RIGHT”,:: nextdir = 4);
)
);