@ -57,42 +57,19 @@ end
function bindKeys ( )
gameRootPanel : setAutoRepeatDelay ( 250 )
g_keyboard.bindKeyDown ( ' Up ' , function ( ) changeWalkDir ( North ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Right ' , function ( ) changeWalkDir ( East ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Down ' , function ( ) changeWalkDir ( South ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Left ' , function ( ) changeWalkDir ( West ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad8 ' , function ( ) changeWalkDir ( North ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad9 ' , function ( ) changeWalkDir ( NorthEast ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad6 ' , function ( ) changeWalkDir ( East ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad3 ' , function ( ) changeWalkDir ( SouthEast ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad2 ' , function ( ) changeWalkDir ( South ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad1 ' , function ( ) changeWalkDir ( SouthWest ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad4 ' , function ( ) changeWalkDir ( West ) end , gameRootPanel , true )
g_keyboard.bindKeyDown ( ' Numpad7 ' , function ( ) changeWalkDir ( NorthWest ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Up ' , function ( ) changeWalkDir ( North , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Right ' , function ( ) changeWalkDir ( East , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Down ' , function ( ) changeWalkDir ( South , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Left ' , function ( ) changeWalkDir ( West , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad8 ' , function ( ) changeWalkDir ( North , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad9 ' , function ( ) changeWalkDir ( NorthEast , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad6 ' , function ( ) changeWalkDir ( East , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad3 ' , function ( ) changeWalkDir ( SouthEast , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad2 ' , function ( ) changeWalkDir ( South , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad1 ' , function ( ) changeWalkDir ( SouthWest , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad4 ' , function ( ) changeWalkDir ( West , true ) end , gameRootPanel , true )
g_keyboard.bindKeyUp ( ' Numpad7 ' , function ( ) changeWalkDir ( NorthWest , true ) end , gameRootPanel , true )
g_keyboard.bindKeyPress ( ' Up ' , function ( ) smartWalk ( North ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Right ' , function ( ) smartWalk ( East ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Down ' , function ( ) smartWalk ( South ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Left ' , function ( ) smartWalk ( West ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad8 ' , function ( ) smartWalk ( North ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad9 ' , function ( ) smartWalk ( NorthEast ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad6 ' , function ( ) smartWalk ( East ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad3 ' , function ( ) smartWalk ( SouthEast ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad2 ' , function ( ) smartWalk ( South ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad1 ' , function ( ) smartWalk ( SouthWest ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad4 ' , function ( ) smartWalk ( West ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Numpad7 ' , function ( ) smartWalk ( NorthWest ) end , gameRootPanel )
bindWalkKey ( ' Up ' , North )
bindWalkKey ( ' Right ' , East )
bindWalkKey ( ' Down ' , South )
bindWalkKey ( ' Left ' , West )
bindWalkKey ( ' Numpad8 ' , North )
bindWalkKey ( ' Numpad9 ' , NorthEast )
bindWalkKey ( ' Numpad6 ' , East )
bindWalkKey ( ' Numpad3 ' , SouthEast )
bindWalkKey ( ' Numpad2 ' , South )
bindWalkKey ( ' Numpad1 ' , SouthWest )
bindWalkKey ( ' Numpad4 ' , West )
bindWalkKey ( ' Numpad7 ' , NorthWest )
g_keyboard.bindKeyPress ( ' Ctrl+Up ' , function ( ) g_game.turn ( North ) changeWalkDir ( North ) end , gameRootPanel )
g_keyboard.bindKeyPress ( ' Ctrl+Right ' , function ( ) g_game.turn ( East ) changeWalkDir ( East ) end , gameRootPanel )
@ -111,6 +88,18 @@ function bindKeys()
g_keyboard.bindKeyDown ( ' Ctrl+. ' , nextViewMode , gameRootPanel )
end
function bindWalkKey ( key , dir )
g_keyboard.bindKeyDown ( key , function ( ) changeWalkDir ( dir ) end )
g_keyboard.bindKeyUp ( key , function ( ) changeWalkDir ( dir , true ) end )
g_keyboard.bindKeyPress ( key , function ( ) smartWalk ( dir ) end )
end
function unbindWalkKey ( key )
g_keyboard.unbindKeyDown ( key )
g_keyboard.unbindKeyUp ( key )
g_keyboard.unbindKeyPress ( key )
end
function terminate ( )
save ( )
hide ( )