summaryrefslogtreecommitdiff
path: root/client/src/logic/movement.ts
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-06-25 18:19:26 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-06-25 18:19:26 -0400
commit0281233cbdc76e065a812780de0325fcfbd4e660 (patch)
tree51b8049b98de607fbb84ded183787a3958fc93f3 /client/src/logic/movement.ts
parentexport and load maps (diff)
downloadtuxman-0281233cbdc76e065a812780de0325fcfbd4e660.tar.gz
tuxman-0281233cbdc76e065a812780de0325fcfbd4e660.tar.bz2
tuxman-0281233cbdc76e065a812780de0325fcfbd4e660.zip
ghost
Diffstat (limited to 'client/src/logic/movement.ts')
-rw-r--r--client/src/logic/movement.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/client/src/logic/movement.ts b/client/src/logic/movement.ts
index f03008b..f2a06e7 100644
--- a/client/src/logic/movement.ts
+++ b/client/src/logic/movement.ts
@@ -1,18 +1,18 @@
import { getMap } from "../map.js"
import { Vec2, Map, Rotation, Key, Player, GameState, Tile } from "../types.js"
-const MOVE_SPEED = .1
+export const MOVE_SPEED = .08333
-const roundPos = (pos: Vec2): Vec2 => {
+export const roundPos = (pos: Vec2): Vec2 => {
return {x: Math.round(pos.x), y: Math.round(pos.y)}
}
-const isStablePos = (pos: Vec2): boolean => {
+export const isStablePos = (pos: Vec2): boolean => {
let rpos = roundPos(pos)
return Math.abs(rpos.x - pos.x) < .05 && Math.abs(rpos.y - pos.y) < .05
}
-const getTile = (
+export const getTile = (
map: Map,
pos: Vec2,
ox: number,
@@ -24,7 +24,7 @@ const getTile = (
return map.data[y * map.width + x]
}
-const getTileFrontWithRot = (
+export const getTileFrontWithRot = (
map: Map,
pos: Vec2,
rot: Rotation
@@ -57,7 +57,7 @@ const getRot = (key: Key): Rotation => {
}
}
-const incrementPos = (
+export const incrementPos = (
pos: Vec2,
rot: Rotation,
speed: number