From 569a0f22f806864ccec634cc5e7648935e3f552c Mon Sep 17 00:00:00 2001 From: Louis Pearson Date: Wed, 9 Feb 2022 00:33:09 -0700 Subject: [PATCH] Implement death Levels will need to be redesigned now. --- src/game.zig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/game.zig b/src/game.zig index 95b29d7..e3c253c 100644 --- a/src/game.zig +++ b/src/game.zig @@ -208,8 +208,10 @@ pub fn start() !void { .kinematic = .{ .col = .{ .pos = .{ -3, -6 }, .size = .{ 5, 5 } } }, }; + _ = try wires.resize(0); for (assets.wire) |wire| { var w = wires.addOne() catch showErr("New wire"); + _ = try w.nodes.resize(0); const divisions = wire.divisions; var i: usize = 0; while (i <= divisions) : (i += 1) { @@ -232,7 +234,7 @@ pub fn start() !void { try circuit.addDoor(door); } - // _ = w4.diskw("", 0); + try coins.resize(0); if (!try Disk.load()) { for (assets.coins) |coin| { coins.append(.{ @@ -308,6 +310,17 @@ pub fn update(time: usize) !State { particles.draw(); + { + const pos = player.pos.pos; + if (getNearestWireInteraction(pos, 8)) |i| { + const wire = wires.get(i.details.wire.id); + const node = wire.nodes.get(i.details.wire.which); + if (i.active and !node.pinned) { + try start(); + } + } + } + { const pos = util.world2cell(player.pos.pos); const shouldHum = circuit.isEnabled(pos) or