summaryrefslogtreecommitdiff
path: root/client/movement.lua
diff options
context:
space:
mode:
Diffstat (limited to 'client/movement.lua')
-rw-r--r--client/movement.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/client/movement.lua b/client/movement.lua
index 2aa870b..5cc6b85 100644
--- a/client/movement.lua
+++ b/client/movement.lua
@@ -10,8 +10,6 @@ local function clamp(x,minv,maxv)
return math.min(math.max(x,minv),maxv)
end
-
-
-- https://iquilezles.org/articles/distgradfunctions2d/
local function iqz_hex_sdgf(px,py, r)
local kx,ky,kz = -0.866025404,0.5,0.577350269
@@ -42,7 +40,6 @@ local function iqz_hex_sdgf(px,py, r)
end
-
-- rotate by 30 degrees
local c30,s30 = math.cos(math.rad(30)), math.sin(math.rad(30))
local function t_in(x,y) return c30*x-s30*y, s30*x+c30*y end
@@ -65,7 +62,8 @@ local function hex_sdgf(pos, hex)
end
local PLAYER_SIZE = require"common.constants".PLAYER_SIZE
-local function collide_with_terrain(old_pos, try_pos, map, tries_remaining)
+local function collide_with_terrain(old_pos, try_pos, map,
+ tries_remaining)
tries_remaining = tries_remaining or 3
if tries_remaining <= 0 then return old_pos end
local try_h = try_pos:to_hex():round()
@@ -77,7 +75,9 @@ local function collide_with_terrain(old_pos, try_pos, map, tries_remaining)
local push_dist = PLAYER_SIZE - d
local push_dir = Pos:make(gx,gy)
local new_try_pos = try_pos + (push_dist*push_dir)
- return collide_with_terrain(old_pos,new_try_pos,map,tries_remaining-1)
+ return collide_with_terrain(
+ old_pos, new_try_pos, map, tries_remaining - 1
+ )
end
end
end