parent
c3227bbd46
commit
569a0f22f8
15
src/game.zig
15
src/game.zig
|
@ -208,8 +208,10 @@ pub fn start() !void {
|
||||||
.kinematic = .{ .col = .{ .pos = .{ -3, -6 }, .size = .{ 5, 5 } } },
|
.kinematic = .{ .col = .{ .pos = .{ -3, -6 }, .size = .{ 5, 5 } } },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_ = try wires.resize(0);
|
||||||
for (assets.wire) |wire| {
|
for (assets.wire) |wire| {
|
||||||
var w = wires.addOne() catch showErr("New wire");
|
var w = wires.addOne() catch showErr("New wire");
|
||||||
|
_ = try w.nodes.resize(0);
|
||||||
const divisions = wire.divisions;
|
const divisions = wire.divisions;
|
||||||
var i: usize = 0;
|
var i: usize = 0;
|
||||||
while (i <= divisions) : (i += 1) {
|
while (i <= divisions) : (i += 1) {
|
||||||
|
@ -232,7 +234,7 @@ pub fn start() !void {
|
||||||
try circuit.addDoor(door);
|
try circuit.addDoor(door);
|
||||||
}
|
}
|
||||||
|
|
||||||
// _ = w4.diskw("", 0);
|
try coins.resize(0);
|
||||||
if (!try Disk.load()) {
|
if (!try Disk.load()) {
|
||||||
for (assets.coins) |coin| {
|
for (assets.coins) |coin| {
|
||||||
coins.append(.{
|
coins.append(.{
|
||||||
|
@ -308,6 +310,17 @@ pub fn update(time: usize) !State {
|
||||||
|
|
||||||
particles.draw();
|
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 pos = util.world2cell(player.pos.pos);
|
||||||
const shouldHum = circuit.isEnabled(pos) or
|
const shouldHum = circuit.isEnabled(pos) or
|
||||||
|
|
Loading…
Reference in New Issue