Using the arrow keys to move around the world

Chris Double chris at double.co.nz
Wed Jul 22 11:42:11 UTC 2009


I can use a radarView to move around the world by pressing buttons -
is there a way to enable moving around with the arrow keys?

I did a quick hack and got something working using normal keys but I
couldn't work out how to ask a key down event if it's one of the arrow
keys. What I got working was to modify 'handleAndForward:To:' in the
handMorph traits. I added code on the keydown check with something
like:

 e metaIsDown && [ e keystrokes includes: 'j' ] ifTrue: [ world
moveHand: self InWorldBy: -500 at 0. ^self. ]

I repeated this for the four keys I wanted for up, down, left and
right. Ideally I'd like to use the arrow keys though since I'm
clashing with some of the editor meta keys.

Chris.
--
http://www.bluishcoder.co.nz



More information about the Self-interest mailing list