aboutsummaryrefslogtreecommitdiff
path: root/src/phys
diff options
context:
space:
mode:
Diffstat (limited to 'src/phys')
-rw-r--r--src/phys/body.odin30
-rw-r--r--src/phys/world.odin16
2 files changed, 23 insertions, 23 deletions
diff --git a/src/phys/body.odin b/src/phys/body.odin
index 09dc95a..6734b2b 100644
--- a/src/phys/body.odin
+++ b/src/phys/body.odin
@@ -8,22 +8,22 @@ Rect :: struct {
}
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
- PLAYER, // player hitboxes
- ENEMY_PROJECTILE,
- PLAYER_PROJECTILE,
+ Default,
+ 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
+ Enemy_Projectile,
+ Player_Projectile,
}
Collision_Type :: enum (u8) {
- UP,
- DOWN,
- RIGHT,
- LEFT,
- HORIZONTAL,
- VERTICAL,
+ Up,
+ Down,
+ Right,
+ Left,
+ Horizontal,
+ Vertical,
}
Body :: struct {
@@ -40,8 +40,8 @@ Body :: struct {
make_body :: proc(
rect: Rect,
- layers := bit_set[Layer;u16]{.DEFAULT},
- mask := bit_set[Layer;u16]{.DEFAULT},
+ layers := bit_set[Layer;u16]{.Default},
+ mask := bit_set[Layer;u16]{.Default},
) -> Body_Handle {
b := Body {
rect = rect,
diff --git a/src/phys/world.odin b/src/phys/world.odin
index aacc8bc..3dbd052 100644
--- a/src/phys/world.odin
+++ b/src/phys/world.odin
@@ -236,30 +236,30 @@ update_body :: proc(h: Body_Handle) {
if aabb_hori(rect, c_rect) {
if b.vel.y > 0 {
res_pos.y = c_rect.start.y - b.rect.size.y - b.rect.start.y
- b.collisions += {.DOWN}
+ b.collisions += {.Down}
} else {
res_pos.y = c_rect.start.y + c_rect.size.y - b.rect.start.y
- b.collisions += {.UP}
+ b.collisions += {.Up}
}
- b.collisions += {.VERTICAL}
+ b.collisions += {.Vertical}
} else if aabb_vert(rect, c.rect) {
if b.vel.x > 0 {
res_pos.x = c_rect.start.x - b.rect.size.x - b.rect.start.x
- b.collisions += {.LEFT}
+ b.collisions += {.Left}
} else {
res_pos.x = c_rect.start.x + c_rect.size.x - b.rect.start.x
- b.collisions += {.RIGHT}
+ b.collisions += {.Right}
}
- b.collisions += {.HORIZONTAL}
+ b.collisions += {.Horizontal}
}
}
}
}
- if .HORIZONTAL in b.collisions {
+ if .Horizontal in b.collisions {
b.vel.x = 0
}
- if .VERTICAL in b.collisions {
+ if .Vertical in b.collisions {
b.vel.y = 0
}