summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-03-24 21:11:10 +0000
committerubq323 <ubq323@ubq323.website>2023-03-24 21:11:10 +0000
commite77609c5bc8b44aa22ef88063246fd05add5e705 (patch)
tree1829e2098e40f7fad82af8707bd8a359edd2be1d /client
parent0927f9297c06525a453b4aad44fa4c2916c75906 (diff)
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
Diffstat (limited to 'client')
-rw-r--r--client/game.lua22
1 files changed, 14 insertions, 8 deletions
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