Compare commits
10 Commits
bd67006e3c
...
e0b8386849
Author | SHA1 | Date | |
---|---|---|---|
e0b8386849 | |||
2b02d2b94b | |||
c90b56b603 | |||
2e8bba2a0e | |||
803062ef43 | |||
b61fe936e3 | |||
63c97d1bee | |||
814149ceec | |||
3b8e86d0e7 | |||
1ba869b644 |
458
updatedshmup.p8
458
updatedshmup.p8
@ -21,6 +21,102 @@ function csv(s)
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- generate standard "overlay"
|
||||||
|
-- constructor for type tt.
|
||||||
|
-- if more is defined, generated
|
||||||
|
-- new calls more(ret) after
|
||||||
|
-- ret is definitely not nil
|
||||||
|
-- before calling setmetatable.
|
||||||
|
-- use to initialize mutables.
|
||||||
|
function mknew(tt, more)
|
||||||
|
local mt = {__index=tt}
|
||||||
|
-- check "more" only once ever
|
||||||
|
if more then
|
||||||
|
tt.new = function(ret)
|
||||||
|
if (not ret) ret = {}
|
||||||
|
more(ret)
|
||||||
|
setmetatable(ret, mt)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
else
|
||||||
|
tt.new=function(ret)
|
||||||
|
if (not ret) ret = {}
|
||||||
|
setmetatable(ret, mt)
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
linked_list = {}
|
||||||
|
mknew(linked_list, function(x)
|
||||||
|
x.next=nil
|
||||||
|
x.tail=x
|
||||||
|
end)
|
||||||
|
|
||||||
|
function linked_list:push_back(x)
|
||||||
|
self.tail.next = x
|
||||||
|
self.tail = x
|
||||||
|
end
|
||||||
|
|
||||||
|
function linked_list:push_front(x)
|
||||||
|
if (not self.next) self.tail = x
|
||||||
|
x.next = self.next
|
||||||
|
self.next = x
|
||||||
|
end
|
||||||
|
|
||||||
|
-- vore eats another linked list
|
||||||
|
-- by appending its contents.
|
||||||
|
-- the ingested linked is empty.
|
||||||
|
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
|
||||||
|
-- node, removing each node for
|
||||||
|
-- which f(x) returns true. it
|
||||||
|
-- returns the new tail; nil
|
||||||
|
-- if the list is now empty.
|
||||||
|
function linked_list:strip(f)
|
||||||
|
local p, n = self, self.next
|
||||||
|
while n do
|
||||||
|
if f(n) then
|
||||||
|
p.next = n.next
|
||||||
|
else
|
||||||
|
p = n
|
||||||
|
end
|
||||||
|
n = n.next
|
||||||
|
end
|
||||||
|
self.tail = p
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
|
||||||
|
-- optimized special case -
|
||||||
|
-- could be done with strip but
|
||||||
|
-- this avoids extra function
|
||||||
|
-- calls and comparisions since
|
||||||
|
-- draw isn't allowed to kill
|
||||||
|
-- the item
|
||||||
|
function linked_list:draw()
|
||||||
|
local n = self.next
|
||||||
|
while n do
|
||||||
|
n:draw()
|
||||||
|
n = n.next
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function linked_list:pop_front()
|
||||||
|
local ret = self.next
|
||||||
|
if (not ret) return
|
||||||
|
self.next = ret.next
|
||||||
|
if (not ret.next) ret.tail = nil
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
function _init()
|
function _init()
|
||||||
init_bullet_mt()
|
init_bullet_mt()
|
||||||
init_powerup_mt()
|
init_powerup_mt()
|
||||||
@ -50,128 +146,98 @@ end
|
|||||||
function wipe_level()
|
function wipe_level()
|
||||||
primary_ship = new_p1()
|
primary_ship = new_p1()
|
||||||
init_hpcols()
|
init_hpcols()
|
||||||
pships = {primary_ship}
|
pships = linked_list.new()
|
||||||
eships = {}
|
pships:push_back(primary_ship)
|
||||||
pbullets = {}
|
eships = linked_list.new()
|
||||||
ebullets = {}
|
pbullets = linked_list.new()
|
||||||
intangibles_fg = {}
|
ebullets = linked_list.new()
|
||||||
intangibles_bg = {}
|
intangibles_fg = linked_list.new()
|
||||||
events = {}
|
intangibles_bg = linked_list.new()
|
||||||
|
events = linked_list.new()
|
||||||
|
new_events = linked_list.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update60()
|
function _update60()
|
||||||
updategame()
|
updategame()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function call_f(x)
|
||||||
|
return x:f()
|
||||||
|
end
|
||||||
|
|
||||||
|
function call_move(x)
|
||||||
|
return x:move()
|
||||||
|
end
|
||||||
|
|
||||||
function updategame()
|
function updategame()
|
||||||
leveldone = level_frame()
|
leveldone = level_frame()
|
||||||
new_events = {}
|
events:vore(new_events)
|
||||||
local deaths = {}
|
events:strip(call_move)
|
||||||
for i, e in ipairs(events) do
|
for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do
|
||||||
if (e()) add(deaths, i)
|
lst:strip(call_move)
|
||||||
end
|
end
|
||||||
bury_the_dead(events, deaths)
|
|
||||||
foreach(new_events, function(e)
|
pships:strip(
|
||||||
add(events, e)
|
function(ps)
|
||||||
end)
|
local pbox, pded = hurtbox(ps), false
|
||||||
deaths = {}
|
eships:strip(
|
||||||
for i, x in ipairs(intangibles_bg) do
|
function(es)
|
||||||
if (x:move()) add(deaths, i)
|
if (not collides(pbox, hurtbox(es))) return
|
||||||
end
|
pded = pded or ps:hitship(es)
|
||||||
bury_the_dead(intangibles_bg, deaths)
|
return es:hitship(ps)
|
||||||
for _, tbl in ipairs({pships, eships, pbullets, ebullets, intangibles}) do
|
end
|
||||||
local deaths = {}
|
)
|
||||||
for i, x in ipairs(tbl) do
|
return pded
|
||||||
if (x:move()) add(deaths, i)
|
end
|
||||||
end
|
)
|
||||||
bury_the_dead(tbl, deaths)
|
pships:strip(
|
||||||
end
|
function(ps)
|
||||||
--then, calculate collisions
|
local pbox, pded = hurtbox(ps), false
|
||||||
local pdeaths = {}
|
ebullets:strip(
|
||||||
local edeaths = {}
|
function(eb)
|
||||||
local eskips = {}
|
if (not collides(pbox, hurtbox(eb))) return
|
||||||
-- todo: always use a collider,
|
pded = pded or ps:hitbullet(eb)
|
||||||
-- it saves if pships is as low as 2s
|
return eb:hitship(ps)
|
||||||
-- pships usually contians 1 thing,
|
end
|
||||||
-- so don't bother with a bucket collider
|
)
|
||||||
for ip, ps in ipairs(pships) do
|
return pded
|
||||||
for ie, es in ipairs(eships) do
|
end
|
||||||
if not eskips[ie] then
|
)
|
||||||
if collides(hurtbox(ps), hurtbox(es)) then
|
|
||||||
if (es:hitship(ps)) then
|
|
||||||
add(edeaths, ie)
|
|
||||||
eskips[ie] = true
|
|
||||||
end
|
|
||||||
if ps:hitship(es) then
|
|
||||||
add(pdeaths, ip)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
bury_the_dead(pships, pdeaths)
|
|
||||||
bury_the_dead(eships, edeaths)
|
|
||||||
pdeaths = {}
|
|
||||||
edeaths = {}
|
|
||||||
eskips = {}
|
|
||||||
for ip, ps in ipairs(pships) do
|
|
||||||
for ie, eb in ipairs(ebullets) do
|
|
||||||
if not eskips[ie] then
|
|
||||||
if collides(hurtbox(ps), hurtbox(eb)) then
|
|
||||||
local dead = false
|
|
||||||
if ps:hitbullet(eb) then
|
|
||||||
add(pdeaths, ip)
|
|
||||||
dead = true
|
|
||||||
end
|
|
||||||
if (eb:hitship(ps)) then
|
|
||||||
add(edeaths, ie)
|
|
||||||
eskips[ie] =true
|
|
||||||
end
|
|
||||||
if (dead) break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
bury_the_dead(pships, pdeaths)
|
|
||||||
bury_the_dead(ebullets, edeaths)
|
|
||||||
pdeaths = {}
|
|
||||||
edeaths = {}
|
|
||||||
-- many bullets and many enemy ships;
|
-- many bullets and many enemy ships;
|
||||||
-- use bucket collider for efficiency
|
-- use bucket collider for efficiency
|
||||||
local pbullet_collider = new_collider()
|
local pbullet_collider = new_collider()
|
||||||
for idx, pb in ipairs(pbullets) do
|
local p, n = pbullets, pbullets.next
|
||||||
pb.___pbullets_idx = idx
|
while n do
|
||||||
pbullet_collider:insert(pb)
|
n.prev = p
|
||||||
|
pbullet_collider:insert(n)
|
||||||
|
p = n
|
||||||
|
n = p.next
|
||||||
end
|
end
|
||||||
|
|
||||||
for es_idx, es in ipairs(eships) do
|
eships:strip(
|
||||||
for pb in all(pbullet_collider:get_collisions(es)) do
|
function(es)
|
||||||
local dead = false
|
for pb in all(pbullet_collider:get_collisions(es)) do
|
||||||
if es:hitbullet(pb) then
|
if pb:hitship(es) then
|
||||||
add(edeaths, es_idx)
|
pbullet_collider:hide(pb)
|
||||||
dead=true
|
pb.prev.next = pb.next
|
||||||
|
if pb.next then
|
||||||
|
pb.next.prev = pb.prev
|
||||||
|
else
|
||||||
|
pbullets.tail = pb.prev
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (es:hitbullet(pb)) return true
|
||||||
end
|
end
|
||||||
if pb:hitship(es) then
|
|
||||||
add(pdeaths, pb.___pbullets_idx)
|
|
||||||
pbullet_collider:hide(pb)
|
|
||||||
end
|
|
||||||
if (dead) break
|
|
||||||
end
|
end
|
||||||
end
|
)
|
||||||
bury_the_dead(eships, edeaths)
|
|
||||||
bury_the_dead(pbullets, pdeaths)
|
intangibles_fg:strip(call_move)
|
||||||
for i, x in ipairs(intangibles_fg) do
|
|
||||||
if (x:move()) add(deaths, i)
|
if leveldone and not eships.next and not ebullets.next and not events.next then
|
||||||
end
|
|
||||||
bury_the_dead(intangibles_fg, deaths)
|
|
||||||
|
|
||||||
if leveldone and ((#eships + #ebullets + #events) == 0) then
|
|
||||||
state = win
|
state = win
|
||||||
end
|
end
|
||||||
if #pships == 0 then
|
if (not pships.next) state = lose
|
||||||
state = lose
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function _draw()
|
function _draw()
|
||||||
@ -236,10 +302,8 @@ end
|
|||||||
function drawgame()
|
function drawgame()
|
||||||
cls()
|
cls()
|
||||||
clip(0,0,112,128)
|
clip(0,0,112,128)
|
||||||
for tbl in all{intangibles_bg, pbullets, pships, eships, ebullets, intangibles_fg} do
|
for slist in all{intangibles_bg, pbullets, pships, eships, ebullets, intangibles_fg} do
|
||||||
for x in all(tbl) do
|
slist:draw()
|
||||||
x:draw()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
clip(0,0,128,128)
|
clip(0,0,128,128)
|
||||||
drawhud()
|
drawhud()
|
||||||
@ -340,30 +404,11 @@ function grab_p1_butts()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function bury_the_dead(tbl, dead)
|
|
||||||
if (#dead == 0) return
|
|
||||||
local tail = dead[1]
|
|
||||||
local head = tail + 1
|
|
||||||
local deaddex = 2
|
|
||||||
|
|
||||||
while head <= #tbl do
|
|
||||||
while deaddex <= #dead and head == dead[deaddex] do
|
|
||||||
deaddex += 1
|
|
||||||
head += 1
|
|
||||||
end
|
|
||||||
if (head > #tbl) break
|
|
||||||
tbl[tail] = tbl[head]
|
|
||||||
head += 1
|
|
||||||
tail += 1
|
|
||||||
end
|
|
||||||
|
|
||||||
for i=1,(head-tail) do
|
|
||||||
deli(tbl)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-->8
|
-->8
|
||||||
--ships, including player
|
--ships, including player
|
||||||
|
|
||||||
|
-- XXX BOOKMARK XXX
|
||||||
|
|
||||||
function init_ship_mt()
|
function init_ship_mt()
|
||||||
setmetatable(player, ship_t)
|
setmetatable(player, ship_t)
|
||||||
setmetatable(frownie, ship_t)
|
setmetatable(frownie, ship_t)
|
||||||
@ -528,7 +573,7 @@ function spawn_spewy_at(x, y)
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
setmetatable(spewy, frownie_t)
|
setmetatable(spewy, frownie_t)
|
||||||
add(eships, spewy)
|
eships:push_back(spewy)
|
||||||
return spewy
|
return spewy
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -575,7 +620,7 @@ function spawn_chasey_at(x, y)
|
|||||||
main_gun = new_gun_of(zap_gun_t, true)
|
main_gun = new_gun_of(zap_gun_t, true)
|
||||||
}
|
}
|
||||||
setmetatable(c, chasey_t)
|
setmetatable(c, chasey_t)
|
||||||
add(eships, c)
|
eships:push_back(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -608,7 +653,7 @@ function spawn_xl_chasey_at(x, y)
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
setmetatable(c, chasey_t)
|
setmetatable(c, chasey_t)
|
||||||
add(eships, c)
|
eships:push_back(c)
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
-->8
|
-->8
|
||||||
@ -642,50 +687,50 @@ ship_t = {
|
|||||||
__index = ship_m,
|
__index = ship_m,
|
||||||
}
|
}
|
||||||
|
|
||||||
function ship_m.die(s)
|
function ship_m:die()
|
||||||
s.dead = true
|
self.dead = true
|
||||||
if (s.hp <= 0) boom(s.x+s.size*4, s.y+s.size*4,12*s.size, s.boss)
|
if (self.hp <= 0) boom(self.x+self.size*4, self.y+self.size*4,12*self.size, self.boss)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ship_m.move(ship)
|
function ship_m:move()
|
||||||
ship:refresh_shield()
|
self:refresh_shield()
|
||||||
ship.power = min(ship.max_power, ship.power + ship.generator)
|
self.power = min(self.max_power, self.power + self.generator)
|
||||||
butt = ship:grab_butts()
|
butt = self:grab_butts()
|
||||||
if (butt[5] > 0) ship:maybe_shoot(ship.main_gun)
|
if (butt[5] > 0) self:maybe_shoot(self.main_gun)
|
||||||
if (butt[4] > 0) ship:maybe_shoot(ship.special_gun)
|
if (butt[4] > 0) self:maybe_shoot(self.special_gun)
|
||||||
if (butt[0]-butt[1] ~= 0 or butt[2]-butt[3] ~= 0) spark(ship.sparks, ship.x + 4*ship.size, ship.y + 4*ship.size, butt, ship.thrust, ship.sparkodds)
|
if (butt[0]-butt[1] ~= 0 or butt[2]-butt[3] ~= 0) spark(self.sparks, self.x + 4*self.size, self.y + 4*self.size, butt, self.thrust, self.sparkodds)
|
||||||
ship.xmomentum += (ship.thrust * butt[1]) - (ship.thrust * butt[0])
|
self.xmomentum += (self.thrust * butt[1]) - (self.thrust * butt[0])
|
||||||
ship.ymomentum += (ship.thrust * butt[3]) - (ship.thrust * butt[2])
|
self.ymomentum += (self.thrust * butt[3]) - (self.thrust * butt[2])
|
||||||
ship.xmomentum = mid(-ship.maxspd, ship.maxspd, ship.xmomentum)
|
self.xmomentum = mid(-self.maxspd, self.maxspd, self.xmomentum)
|
||||||
ship.ymomentum = mid(-ship.maxspd, ship.maxspd, ship.ymomentum)
|
self.ymomentum = mid(-self.maxspd, self.maxspd, self.ymomentum)
|
||||||
|
|
||||||
ship.x += ship.xmomentum
|
self.x += self.xmomentum
|
||||||
ship.y += ship.ymomentum
|
self.y += self.ymomentum
|
||||||
|
|
||||||
if ship == primary_ship then
|
if self == primary_self then
|
||||||
ship.x = mid(0, 112 - 8 * ship.size, ship.x)
|
self.x = mid(0, 112 - 8 * self.size, self.x)
|
||||||
ship.y = mid(0, 128 - 8 * ship.size, ship.y)
|
self.y = mid(0, 128 - 8 * self.size, self.y)
|
||||||
end
|
end
|
||||||
|
|
||||||
--friction
|
--friction
|
||||||
local d = ship.drag
|
local d = self.drag
|
||||||
ship.xmomentum -= mid(d, -d, ship.xmomentum)
|
self.xmomentum -= mid(d, -d, self.xmomentum)
|
||||||
ship.ymomentum -= mid(d, -d, ship.ymomentum)
|
self.ymomentum -= mid(d, -d, self.ymomentum)
|
||||||
|
|
||||||
-- "scrolling" behavior
|
-- "scrolling" behavior
|
||||||
if ship.slip then
|
if self.slip then
|
||||||
ship.y += scrollrate
|
self.y += scrollrate
|
||||||
if ship.y >= 128 then
|
if self.y >= 128 then
|
||||||
ship:die()
|
self:die()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function ship_m.draw(ship)
|
function ship_m:draw()
|
||||||
if(ship.fx_pal) pal(ship.fx_pal)
|
if(self.fx_pal) pal(self.fx_pal)
|
||||||
spr(ship.sprite, ship.x, ship.y, ship.size, ship.size)
|
spr(self.sprite, self.x, self.y, self.size, self.size)
|
||||||
pal()
|
pal()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -888,7 +933,7 @@ function spawn_rnd_x(mt)
|
|||||||
y = -(mt.__index.size * 8 - 1)
|
y = -(mt.__index.size * 8 - 1)
|
||||||
}
|
}
|
||||||
setmetatable(s, mt)
|
setmetatable(s, mt)
|
||||||
add(eships, s)
|
eships:push_back(s)
|
||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -905,7 +950,7 @@ function spawn_blocking_rnd_x(mt)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
setmetatable(s, mt)
|
setmetatable(s, mt)
|
||||||
add(eships, s)
|
eships:push_back(s)
|
||||||
return s
|
return s
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -985,13 +1030,13 @@ function spawn_blocking_boss_chasey()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local nextspawn = lframe + 120
|
local nextspawn = lframe + 120
|
||||||
add(events, function()
|
events:push_back{move=function()
|
||||||
if lframe >= nextspawn then
|
if lframe >= nextspawn then
|
||||||
helpers[flr(rnd(#helpers))+1]()
|
helpers[flr(rnd(#helpers))+1]()
|
||||||
nextspawn += 60
|
nextspawn += 60
|
||||||
end
|
end
|
||||||
return c.dead
|
return c.dead
|
||||||
end)
|
end}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
end
|
end
|
||||||
@ -1028,13 +1073,13 @@ example_level = {
|
|||||||
[500]=function()
|
[500]=function()
|
||||||
local tnext = lframe
|
local tnext = lframe
|
||||||
local remain = 20
|
local remain = 20
|
||||||
add(events, function()
|
events:push_back{move=function()
|
||||||
if (lframe < tnext) return false
|
if (lframe < tnext) return false
|
||||||
spawn_blocking_blocky()
|
spawn_blocking_blocky()
|
||||||
tnext = lframe + 12
|
tnext = lframe + 12
|
||||||
remain -= 1
|
remain -= 1
|
||||||
return (remain <= 0)
|
return (remain <= 0)
|
||||||
end)
|
end}
|
||||||
end,
|
end,
|
||||||
[501]=spawn_bonus_frownie,
|
[501]=spawn_bonus_frownie,
|
||||||
[620]=spawn_blocking_blocky,
|
[620]=spawn_blocking_blocky,
|
||||||
@ -1122,21 +1167,31 @@ blast = {
|
|||||||
damage = 4,
|
damage = 4,
|
||||||
dx = 0, -- px/frame
|
dx = 0, -- px/frame
|
||||||
dy = 2,
|
dy = 2,
|
||||||
|
awaitcancel = false,
|
||||||
|
|
||||||
-- disable damage for 2 frames
|
-- disable damage for 2 frames
|
||||||
-- when hitting something
|
-- when hitting something
|
||||||
hitship = function(self, _)
|
hitship = function(self, _)
|
||||||
self.damage = 0
|
if self.damage > 0 and not self.awaitcancel then
|
||||||
local wait = 2
|
self.awaitcancel = true
|
||||||
e = function()
|
events:push_back{move = function()
|
||||||
wait -= 1
|
new_events:push_back{
|
||||||
if wait <= 0 then
|
wait = 2,
|
||||||
self.damage = 4
|
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
|
||||||
return true
|
return true
|
||||||
end
|
end}
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
add(events, e)
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
blast_t = {
|
blast_t = {
|
||||||
@ -1330,10 +1385,10 @@ function bullet_base:spawn_at(x, y)
|
|||||||
self.dx *= self.enemyspd
|
self.dx *= self.enemyspd
|
||||||
self.dy *= self.enemyspd
|
self.dy *= self.enemyspd
|
||||||
self.y = y + self.top_y_off
|
self.y = y + self.top_y_off
|
||||||
add(ebullets, self)
|
ebullets:push_back(self)
|
||||||
else
|
else
|
||||||
self.y = y - (8 * self.height) + self.bottom_y_off
|
self.y = y - (8 * self.height) + self.bottom_y_off
|
||||||
add(pbullets, self)
|
pbullets:push_back(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1778,35 +1833,31 @@ weird coding conventions
|
|||||||
-- standard events
|
-- standard events
|
||||||
|
|
||||||
blip_fx = {
|
blip_fx = {
|
||||||
abort = function(self)
|
cancel=false
|
||||||
self.cancel = true
|
|
||||||
end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blip_fx_t = {
|
function blip_fx:move()
|
||||||
__index = blink_fx,
|
if (self.cancel) return true
|
||||||
__call = function(self)
|
self.frames -= 1
|
||||||
if (self.cancel) return true
|
if self.frames < 0 then
|
||||||
self.frames -= 1
|
self.obj.fx_pal = nil
|
||||||
if self.frames < 0 then
|
return true
|
||||||
self.obj.fx_pal = nil
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
}
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
function blip_fx:abort()
|
||||||
|
self.cancel=true
|
||||||
|
end
|
||||||
|
|
||||||
|
mknew(blip_fx)
|
||||||
|
|
||||||
function blip(obj, col, frames)
|
function blip(obj, col, frames)
|
||||||
local p = {[0]=0}
|
local p = {[0]=0}
|
||||||
obj.fx_pal = p
|
obj.fx_pal = p
|
||||||
for i=1,15 do p[i]=col end
|
for i=1,15 do p[i]=col end
|
||||||
if (obj.___fx_pal_event) obj.___fx_pal_event:abort()
|
if (obj.___fx_pal_event) obj.___fx_pal_event:abort()
|
||||||
local e = {
|
events:push_back(blip_fx.new{frames=frames, obj=obj})
|
||||||
frames = frames,
|
|
||||||
obj = obj
|
|
||||||
}
|
|
||||||
setmetatable(e, blip_fx_t)
|
|
||||||
add(events, e)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
bossspark = split"7,7,10,10,9,9,9,8,8,8,2,2,5,5"
|
bossspark = split"7,7,10,10,9,9,9,8,8,8,2,2,5,5"
|
||||||
@ -1831,7 +1882,8 @@ end
|
|||||||
function spark(sprs, x, y, butts, thrust, odds, fg)
|
function spark(sprs, x, y, butts, thrust, odds, fg)
|
||||||
if (sprs==nil or flr(rnd(odds)) ~= 0) return
|
if (sprs==nil or flr(rnd(odds)) ~= 0) return
|
||||||
thrust *= 2.5
|
thrust *= 2.5
|
||||||
add(fg and intangibles_fg or intangibles_bg, {
|
local target = fg and intangibles_fg or intangibles_bg
|
||||||
|
target:push_back{
|
||||||
x = x + rnd(4) - 2,
|
x = x + rnd(4) - 2,
|
||||||
y = y + rnd(4) - 2,
|
y = y + rnd(4) - 2,
|
||||||
sprs = sprs,
|
sprs = sprs,
|
||||||
@ -1849,7 +1901,7 @@ function spark(sprs, x, y, butts, thrust, odds, fg)
|
|||||||
self.dx -= mid(0.05,-0.05, self.dx)
|
self.dx -= mid(0.05,-0.05, self.dx)
|
||||||
self.dy -= mid(0.05,-0.05, self.dy)
|
self.dy -= mid(0.05,-0.05, self.dy)
|
||||||
end
|
end
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
-->8
|
-->8
|
||||||
-- powerups
|
-- powerups
|
||||||
|
Loading…
Reference in New Issue
Block a user