Skip to content

Commit

Permalink
Fix diagonal shield collision detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ibillingsley committed Aug 22, 2022
1 parent 22c7359 commit f8a0ac1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
Binary file modified dist/one-slime-army.wasm
Binary file not shown.
4 changes: 1 addition & 3 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ const Player = struct {
.x = self.pos.x + self.look_dir.x * 2 - target.x,
.y = self.pos.y + self.look_dir.y * 2 - target.y,
};
return diff.length() < (7.5 + radius) and
diff.x * self.look_dir.x <= 0 and
diff.y * self.look_dir.y <= 0;
return diff.length() < 7.5 + radius and diff.dot(self.look_dir) <= 0;
}

fn collideAttack(self: @This(), target: Vec(f64), radius: f64) bool {
Expand Down
2 changes: 1 addition & 1 deletion wapm.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ibillingsley/one-slime-army"
version = "1.1.1"
version = "1.2.0"
description = "One Slime Army is an arcade endless wave survival game for the WASM-4 fantasy console"
license = "ISC"
readme = "README.md"
Expand Down

0 comments on commit f8a0ac1

Please sign in to comment.