swap Vec2 up/down

going down on the grid increases the int for y
This commit is contained in:
ryan 2023-11-01 12:08:43 -07:00
parent 2418d2ff0d
commit 80f29ae00e
2 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ let next_pos head tail =
then tail
else (
let x_dir = if dx > 0 then Vec2.right else Vec2.left in
let y_dir = if dy > 0 then Vec2.up else Vec2.down in
let y_dir = if dy > 0 then Vec2.down else Vec2.up in
let dir =
if abs dx = abs dy
then Vec2.(x_dir + y_dir)

View File

@ -7,10 +7,10 @@ type t =
[@@deriving show]
let origin = { x = 0; y = 0 }
let up = { x = 0; y = 1 }
let down = { x = 0; y = -1 }
let left = { x = -1; y = 0 }
let up = { x = 0; y = -1 }
let down = { x = 0; y = 1 }
let right = { x = 1; y = 0 }
let left = { x = -1; y = 0 }
let directions = [ up; down; left; right ]
let of_tuple (x, y) = { x; y }
let to_tuple { x; y } = x, y