fix sfx on npc

This commit is contained in:
James Turk 2023-03-09 00:35:10 -06:00
parent 89f64fe4c4
commit 63b8a7800a

View File

@ -429,6 +429,8 @@ function npc_upd()
npc.draw = draw_fan npc.draw = draw_fan
npc.collide = heart npc.collide = heart
npc.sound = 7 npc.sound = 7
else
npc.draw = nil
end end
npc.last = distance npc.last = distance
npc.y = rnd(40) npc.y = rnd(40)
@ -438,7 +440,6 @@ function npc_upd()
if rnd() < 0.5 then if rnd() < 0.5 then
npc.x += 140 npc.x += 140
npc.dx *= -1 npc.dx *= -1
sound(7)
end end
end end
@ -451,6 +452,7 @@ function npc_upd()
if npc.y > 80 and npc.x+8 > l and npc.x < r and npc.collide != nil then if npc.y > 80 and npc.x+8 > l and npc.x < r and npc.collide != nil then
npc.collide() npc.collide()
npc.collide = nil npc.collide = nil
sfx(npc.sound)
end end
end end