Compare commits

..

No commits in common. "e0b8386849d72ac531a2d44fb51e3d057f3db22f" and "c90b56b603d89355a0870bd37b6f68a351ee0992" have entirely different histories.

View File

@ -66,13 +66,12 @@ end
-- vore eats another linked list
-- by appending its contents.
-- the ingested linked is empty.
-- the ingested linked
-- list is no longer valid.
function linked_list:vore(x)
if (not x.next) return
self.tail.next = x.next
self.tail = x.tail
x.next = nil
x.tail = x
end
-- strip calls f(x) for each
@ -154,7 +153,6 @@ function wipe_level()
intangibles_fg = linked_list.new()
intangibles_bg = linked_list.new()
events = linked_list.new()
new_events = linked_list.new()
end
function _update60()
@ -171,8 +169,9 @@ end
function updategame()
leveldone = level_frame()
events:vore(new_events)
new_events = linked_list.new()
events:strip(call_move)
events:vore(new_events)
for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do
lst:strip(call_move)
end
@ -1167,31 +1166,20 @@ blast = {
damage = 4,
dx = 0, -- px/frame
dy = 2,
awaitcancel = false,
-- disable damage for 2 frames
-- when hitting something
hitship = function(self, _)
if self.damage > 0 and not self.awaitcancel then
self.awaitcancel = true
events:push_back{move = function()
new_events:push_back{
wait = 2,
obj = self,
saved_dmg = self.damage,
move = function(self)
self.wait -= 1
if self.wait <= 0 then
self.obj.damage = self.saved_dmg
return true
end
end,
}
self.damage = 0
self.awaitcancel = false
self.damage = 0
local wait = 2
events:push_back{move=function()
wait -= 1
if wait <= 0 then
self.damage = 4
return true
end}
end
end
return false
end}
end
}
blast_t = {