Compare commits

..

2 Commits

Author SHA1 Message Date
9ef762268f
many assorted syntax errors 2023-12-20 13:04:13 -08:00
e50f516b11
allow strings when spawning guns 2023-12-20 12:00:34 -08:00

View File

@ -691,7 +691,7 @@ spewy = frownie.new{
} }
mknew(spewy, function(ship) mknew(spewy, function(ship)
ship.main_gun=ship.main_gun or protron_gun.new{enemy=true} ship.main_gun=ship.main_gun or protron_gun.new{enemy=true}
end}) end)
chasey = ship_m.new{ chasey = ship_m.new{
sprite = 5, sprite = 5,
@ -872,7 +872,7 @@ function load_level(levelfile)
currentlevel[row[1]]=row currentlevel[row[1]]=row
end end
end end
assert found_eol assert(found_eol)
end end
function level_frame() function level_frame()
@ -889,7 +889,7 @@ function level_frame()
while cbs do while cbs do
assert(cbs[1] == distance) assert(cbs[1] == distance)
local f = _ENV[cbs[2]] local f = _ENV[cbs[2]]
assert(type(f) == "function", cbs[2].." at "..distance..." is not a function") assert(type(f) == "function", cbs[2].." at "..distance.." is not a function")
f(unpack(cbs, 3)) f(unpack(cbs, 3))
cbs=cbs.next cbs=cbs.next
end end
@ -914,7 +914,7 @@ function spawn_blocking_rnd_x(typ)
freeze -= self.ice freeze -= self.ice
self.ice = 0 self.ice = 0
self:orig_die() self:orig_die()
end end,
} }
eships:push_back(s) eships:push_back(s)
return s return s
@ -1020,14 +1020,14 @@ function spawn_rnd(typ, blocking, goodie,altspr)
freeze += blocking freeze += blocking
s = typ.new{ s = typ.new{
x = rnd(104), x = rnd(104),
y = -(typ.size * 8 - 1) y = -(typ.size * 8 - 1),
ice=blocking ice=blocking,
die=function(self) die=function(self)
freeze -= self.ice freeze -= self.ice
self.ice=0 self.ice=0
typ.die(self) typ.die(self)
spawn_goodie(goodie, self.x, self.y, self.size) spawn_goodie(goodie, self.x, self.y, self.size)
end end,
} }
if (altspr) s.spr = altspr if (altspr) s.spr = altspr
eships:push_back(s) eships:push_back(s)
@ -1043,7 +1043,7 @@ function spawn_goodie(goodie_name, x, y, sz)
end end
function multi(times, interval, fnm, ...) function multi(times, interval, fnm, ...)
local f,irm = _ENV[fnm],interval local f,irm,vargs = _ENV[fnm],interval,pack(...)
assert(type(f) == "function", fnm.." not a function") assert(type(f) == "function", fnm.." not a function")
fnm(...) fnm(...)
events:push_back{move=function() events:push_back{move=function()
@ -1051,7 +1051,7 @@ function multi(times, interval, fnm, ...)
if irm <= 0 then if irm <= 0 then
irm=interval irm=interval
times-=1 times-=1
fnm(...) fnm(unpack(vargs))
return times <= 1 return times <= 1
end end
end} end}
@ -1943,6 +1943,7 @@ gun_swap = powerup.new{
mknew(gun_swap) mknew(gun_swap)
function spawn_main_gun_at(x, y, gunt) function spawn_main_gun_at(x, y, gunt)
if (type(gunt)=="string") gunt=_ENV[gunt]
local gun_p = gun_swap.new{ local gun_p = gun_swap.new{
gun = gunt.new() gun = gunt.new()
} }
@ -1956,6 +1957,7 @@ spec_gun_pl = {
} }
function spawn_spec_gun_at(x, y, gunt) function spawn_spec_gun_at(x, y, gunt)
if (type(gunt)=="string") gunt=_ENV[gunt]
local gun_p = gun_swap.new{ local gun_p = gun_swap.new{
gun = gunt.new(), gun = gunt.new(),
hitship = function(self, ship) hitship = function(self, ship)