diff options
| author | iamcheeseman <[hidden email]> | 2026-01-13 00:01:44 -0500 |
|---|---|---|
| committer | iamcheeseman <[hidden email]> | 2026-01-13 00:01:44 -0500 |
| commit | afb58a61abd0e8114a090ab0ad664d59c10dd4b1 (patch) | |
| tree | 241788a343d7a206f1bb9394519d6f562eda8c21 /src/phys/body.odin | |
| parent | 58de3f9ddc72c5dbf433e45babb43a06c819cb4f (diff) | |
formatter
Diffstat (limited to 'src/phys/body.odin')
| -rw-r--r-- | src/phys/body.odin | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/phys/body.odin b/src/phys/body.odin index 0fe6c51..d568186 100644 --- a/src/phys/body.odin +++ b/src/phys/body.odin @@ -7,15 +7,15 @@ Rect :: struct { size: Vec2, } -Layer :: enum(u16) { +Layer :: enum (u16) { DEFAULT, - HARD, // hard collisions; don't let bodies intersect at all - SOFT, // soft collisions; push away other bodies with a force - ENEMY, // enemy hitboxes + HARD, // hard collisions; don't let bodies intersect at all + SOFT, // soft collisions; push away other bodies with a force + ENEMY, // enemy hitboxes PLAYER, // player hitboxes } -Collision_Type :: enum(u8) { +Collision_Type :: enum (u8) { UP, DOWN, RIGHT, @@ -31,20 +31,23 @@ Body :: struct { active: bool, pos: Vec2, vel: Vec2, - collisions: bit_set[Collision_Type; u8], - layers: bit_set[Layer; u16], - mask: bit_set[Layer; u16], + collisions: bit_set[Collision_Type;u8], + layers: bit_set[Layer;u16], + mask: bit_set[Layer;u16], } make_body :: proc( rect: Rect, - layers := bit_set[Layer; u16]{.DEFAULT}, - mask := bit_set[Layer; u16]{.DEFAULT}, -) -> (Body_Handle, ^Body) { + layers := bit_set[Layer;u16]{.DEFAULT}, + mask := bit_set[Layer;u16]{.DEFAULT}, +) -> ( + Body_Handle, + ^Body, +) { b := Body { - rect = rect, + rect = rect, layers = layers, - mask = mask, + mask = mask, active = true, } return add_body(b) @@ -61,4 +64,3 @@ aabb_vert :: proc(a: Rect, b: Rect) -> bool { aabb :: proc(a: Rect, b: Rect) -> bool { return aabb_hori(a, b) && aabb_vert(a, b) } - |
