summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2023-02-13 13:05:55 +0000
committerubq323 <ubq323@ubq323.website>2023-02-13 13:05:55 +0000
commit7e0a520f8efd748a13c277b3c39514aee07c74d2 (patch)
treeba92438a2c2008103bb5af6acb0e01538fa15dce /client
parent0abc0b9b7928cd72b1c92b3af9f30674397013d1 (diff)
change blank and ubqorange tiles from false and true to 0 and 9
Diffstat (limited to 'client')
-rw-r--r--client/drawing.lua8
-rw-r--r--client/main.lua13
-rw-r--r--client/movement.lua2
3 files changed, 11 insertions, 12 deletions
diff --git a/client/drawing.lua b/client/drawing.lua
index 31c5893..e3dc751 100644
--- a/client/drawing.lua
+++ b/client/drawing.lua
@@ -38,6 +38,8 @@ local colors = {
c(64,64,255), -- blue
c(192,0,192), -- purple
c(128,128,128), -- grey
+
+ c(0xe7,0x9e,0), -- ubqorange
}
-- precompute sins and cosines
local _coss,_sins = {},{}
@@ -59,7 +61,7 @@ local function draw_hex(cpos,color,zoom)
_corners[2*i ] = y
end
-- love.graphics.setColor(love.math.colorFromBytes(0xe7,0x9e,0))
- love.graphics.setColor(color or {0.91,0.62,0})
+ love.graphics.setColor(color)
love.graphics.polygon("fill",_corners)
if zoom > zthr0 then
love.graphics.setLineWidth(0.1)
@@ -85,10 +87,8 @@ local function draw_map(camera,map)
_h:init(q,r)
_h:to_pos(_p)
local t = map:at(_h)
- if type(t) == "number" then
+ if t ~= nil and t ~= 0 then
draw_hex(_p,colors[t],camera.zoom)
- elseif t then
- draw_hex(_p,nil,camera.zoom)
end
end
end
diff --git a/client/main.lua b/client/main.lua
index 4941814..244925e 100644
--- a/client/main.lua
+++ b/client/main.lua
@@ -95,13 +95,12 @@ function love.update(dt)
end
local mh = camera:screen_to_world(Pos:make(love.mouse.getPosition())):to_hex():round()
- if false== map:at(mh) and love.mouse.isDown(1) then
- map:set_at(mh,true)
- send_settile(mh,true)
- elseif map:at(mh) and love.mouse.isDown(2) then
- map:set_at(mh,false)
- -- print(mh,false)
- send_settile(mh,false)
+ if map:at(mh) == 0 and love.mouse.isDown(1) then
+ map:set_at(mh,9)
+ send_settile(mh,9)
+ elseif map:at(mh) ~= 0 and love.mouse.isDown(2) then
+ map:set_at(mh,0)
+ send_settile(mh,0)
end
if local_player then
diff --git a/client/movement.lua b/client/movement.lua
index 78af5f0..3c9f104 100644
--- a/client/movement.lua
+++ b/client/movement.lua
@@ -71,7 +71,7 @@ local function collide_with_terrain(old_pos, try_pos, map, tries_remaining)
local try_h = try_pos:to_hex():round()
for near_h in try_h:iter_neighbours(1) do
local tile = map:at(near_h)
- if tile then
+ if tile ~= 0 then
local d,gx,gy = hex_sdgf(try_pos, near_h)
if d < PLAYER_SIZE then
local push_dist = PLAYER_SIZE - d