Skip to content

Commit

Permalink
Revert spider draw rounding to original version
Browse files Browse the repository at this point in the history
  • Loading branch information
ibillingsley committed Aug 23, 2022
1 parent f8a0ac1 commit c124da1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Binary file modified dist/one-slime-army.wasm
Binary file not shown.
34 changes: 17 additions & 17 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,30 @@ const Spider = struct {
}

fn draw(self: @This()) void {
const x = self.pos.x;
const y = self.pos.y;
const x = round(i32, self.pos.x);
const y = round(i32, self.pos.y);
const flip: f64 = if ((frame_count / 5 + self.id) % 2 == 0) 1 else -1;
w4.DRAW_COLORS.* = 4;
drawLineF(
x + self.dir.x * (2 + flip) + self.dir.y * 4,
y + self.dir.y * (2 + flip) - self.dir.x * 4,
x - self.dir.x * (2 + flip) - self.dir.y * 4,
y - self.dir.y * (2 + flip) + self.dir.x * 4,
w4.line(
x + round(i32, self.dir.x * (2 + flip) + self.dir.y * 4),
y + round(i32, self.dir.y * (2 + flip) - self.dir.x * 4),
x - round(i32, self.dir.x * (2 + flip) + self.dir.y * 4),
y - round(i32, self.dir.y * (2 + flip) - self.dir.x * 4),
);
drawLineF(
x + self.dir.x * (2 - flip) - self.dir.y * 4,
y + self.dir.y * (2 - flip) + self.dir.x * 4,
x - self.dir.x * (2 - flip) + self.dir.y * 4,
y - self.dir.y * (2 - flip) - self.dir.x * 4,
w4.line(
x + round(i32, self.dir.x * (2 - flip) - self.dir.y * 4),
y + round(i32, self.dir.y * (2 - flip) + self.dir.x * 4),
x - round(i32, self.dir.x * (2 - flip) - self.dir.y * 4),
y - round(i32, self.dir.y * (2 - flip) + self.dir.x * 4),
);
drawCircleF(x, y, 5);
drawCircle(x, y, 5);
drawPixel(
round(i32, x + self.dir.x * 4 + self.dir.y * 1.5),
round(i32, y + self.dir.y * 4 - self.dir.x * 1.5),
x + round(i32, self.dir.x * 4 + self.dir.y * 1.5),
y + round(i32, self.dir.y * 4 - self.dir.x * 1.5),
);
drawPixel(
round(i32, x + self.dir.x * 4 - self.dir.y * 1.5),
round(i32, y + self.dir.y * 4 + self.dir.x * 1.5),
x + round(i32, self.dir.x * 4 - self.dir.y * 1.5),
y + round(i32, self.dir.y * 4 + self.dir.x * 1.5),
);
}

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.2.0"
version = "1.2.1"
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 c124da1

Please sign in to comment.