From e77609c5bc8b44aa22ef88063246fd05add5e705 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 24 Mar 2023 21:11:10 +0000 Subject: use lmdb for world storage; plus other small things support numpad 8456 for movement in addition to wasd refactor server and add player module update outdated documentation slightly --- client/game.lua | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'client/game.lua') diff --git a/client/game.lua b/client/game.lua index fd4ade9..aa2e94c 100644 --- a/client/game.lua +++ b/client/game.lua @@ -122,12 +122,17 @@ local remote_players = {} local function update_local_player(pl,dt) local SPEED = 8*math.sqrt(3) -- 8 hexagonheights per second - if love.keyboard.isDown("lshift") then SPEED = SPEED*2 end - local function kd(code) - if love.keyboard.isScancodeDown(code) then return 1 else return 0 end + if love.keyboard.isDown("lshift") or love.keyboard.isScancodeDown'kpenter' then + SPEED = SPEED*2 end - local dx = kd"d"-kd"a" - local dy = kd"s"-kd"w" + local function kd(codes) + for _,code in ipairs(codes) do + if love.keyboard.isScancodeDown(code) then return 1 end + end + return 0 + end + local dx = kd{"d","kp6"}-kd{"a","kp4"} + local dy = kd{"s","kp5"}-kd{"w","kp8"} if dx == 0 and dy == 0 then return @@ -262,9 +267,7 @@ local function draw() draw_player(pl) end - love.graphics.setColor(1,0,0) - love.graphics.rectangle("fill",0,0,1,1) - + -- mouse position (resp. screen, world, hex) local sm = Pos:make(love.mouse.getPosition()) local wm = camera:screen_to_world(sm) local hm = wm:to_hex() @@ -290,7 +293,9 @@ local function draw() love.graphics.origin() + -- selected tile (temp) util.print_good(tostring(selected_tile), "center",10) + if _G.debugmode and local_player then util.print_good(table.concat({ "ms "..tostring(sm), @@ -307,6 +312,7 @@ local function draw() },"\n"),10,10) end + if show_controls then util.print_good(help_text,"center","center") end -- cgit v1.2.3