swap Vec2 up/down
going down on the grid increases the int for y
This commit is contained in:
parent
2418d2ff0d
commit
80f29ae00e
|
|
@ -24,7 +24,7 @@ let next_pos head tail =
|
||||||
then tail
|
then tail
|
||||||
else (
|
else (
|
||||||
let x_dir = if dx > 0 then Vec2.right else Vec2.left in
|
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 =
|
let dir =
|
||||||
if abs dx = abs dy
|
if abs dx = abs dy
|
||||||
then Vec2.(x_dir + y_dir)
|
then Vec2.(x_dir + y_dir)
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,10 @@ type t =
|
||||||
[@@deriving show]
|
[@@deriving show]
|
||||||
|
|
||||||
let origin = { x = 0; y = 0 }
|
let origin = { x = 0; y = 0 }
|
||||||
let up = { x = 0; y = 1 }
|
let up = { x = 0; y = -1 }
|
||||||
let down = { x = 0; y = -1 }
|
let down = { x = 0; y = 1 }
|
||||||
let left = { x = -1; y = 0 }
|
|
||||||
let right = { x = 1; y = 0 }
|
let right = { x = 1; y = 0 }
|
||||||
|
let left = { x = -1; y = 0 }
|
||||||
let directions = [ up; down; left; right ]
|
let directions = [ up; down; left; right ]
|
||||||
let of_tuple (x, y) = { x; y }
|
let of_tuple (x, y) = { x; y }
|
||||||
let to_tuple { x; y } = x, y
|
let to_tuple { x; y } = x, y
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user