Implement death

Levels will need to be redesigned now.
master
Louis Pearson 2022-02-09 00:33:09 -07:00
parent c3227bbd46
commit 569a0f22f8
1 changed files with 14 additions and 1 deletions

View File

@ -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