Skip to content

Instantly share code, notes, and snippets.

@TomK32
Created November 12, 2012 20:28
Show Gist options
  • Select an option

  • Save TomK32/4061679 to your computer and use it in GitHub Desktop.

Select an option

Save TomK32/4061679 to your computer and use it in GitHub Desktop.
-- moving around with my numpad. thanks to #ludumdare
if love.keyboard.isDown('up', 'down','left', 'right', 'kp1', 'kp2', 'kp3', 'kp4', 'kp6', 'kp7', 'kp8', 'kp9') then
if dt_since_last_move + dt > 0.1 then
dt_since_last_move = 0
if love.keyboard.isDown('rshift', 'lshift') then
moves = 5
else
moves = 1
end
movements = {
up = { y = - moves },
kp8 = { y = - moves },
down = { y = moves },
kp2 = { y = moves },
left = { x = - moves },
kp4 = { x = - moves },
right = { x = moves },
kp6 = { x = moves },
kp7 = { x = - moves, y = - moves },
kp9 = { x = moves, y = - moves },
kp1 = { x = - moves, y = moves },
kp3 = { x = moves, y = moves },
}
for key, m in pairs(movements) do
if love.keyboard.isDown(key) then
gui_main.map_view:moveCursor(m)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment