Compare commits
9 Commits
c01c3400b7
...
fast_bulle
Author | SHA1 | Date | |
---|---|---|---|
c9d7437ffe
|
|||
d0de757b0e
|
|||
a8b5b9dbe6
|
|||
2596f8aa6c
|
|||
ef40c245f8
|
|||
6d6e13cf3b
|
|||
99323be298
|
|||
85c5091804
|
|||
a77180d89a
|
169
vacuum_gambit.p8
169
vacuum_gambit.p8
@ -107,6 +107,22 @@ function linked_list:strip(f)
|
|||||||
self.tail = p
|
self.tail = p
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- stripmove calls x:move() for
|
||||||
|
-- each node, removing each node
|
||||||
|
-- for which x:move() is true.
|
||||||
|
function linked_list:stripmove()
|
||||||
|
local p, n = self, self.next
|
||||||
|
while n do
|
||||||
|
if n:move() then
|
||||||
|
p.next = n.next
|
||||||
|
else
|
||||||
|
p = n
|
||||||
|
end
|
||||||
|
n = n.next
|
||||||
|
end
|
||||||
|
self.tail = p
|
||||||
|
end
|
||||||
|
|
||||||
-- optimized special case -
|
-- optimized special case -
|
||||||
-- could be done with strip but
|
-- could be done with strip but
|
||||||
-- this avoids extra function
|
-- this avoids extra function
|
||||||
@ -185,14 +201,6 @@ function _update60()
|
|||||||
mode:update()
|
mode:update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function call_f(x)
|
|
||||||
return x:f()
|
|
||||||
end
|
|
||||||
|
|
||||||
function call_move(x)
|
|
||||||
return x:move()
|
|
||||||
end
|
|
||||||
|
|
||||||
function ones(n)
|
function ones(n)
|
||||||
local ret = 0
|
local ret = 0
|
||||||
while n != 0 do
|
while n != 0 do
|
||||||
@ -230,12 +238,11 @@ function updategame()
|
|||||||
interlude -= 1
|
interlude -= 1
|
||||||
else
|
else
|
||||||
current_wave = flotilla.new()
|
current_wave = flotilla.new()
|
||||||
current_wave:load(0, 0, min(ones(waves_complete)\2, 4))
|
current_wave:load(rnd() > 0.5 and 7 or 0, 0, min(ones(waves_complete)\2, 4))
|
||||||
end
|
end
|
||||||
events:vore(new_events)
|
events:vore(new_events)
|
||||||
events:strip(call_move)
|
for _, lst in ipairs{events, intangibles_bg, eships} do
|
||||||
for _, lst in ipairs{intangibles_bg, eships, pbullets} do
|
lst:stripmove()
|
||||||
lst:strip(call_move)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- eship collider will be used
|
-- eship collider will be used
|
||||||
@ -250,24 +257,33 @@ function updategame()
|
|||||||
if(es:hitship(ps)) eship_collider:yoink(es)
|
if(es:hitship(ps)) eship_collider:yoink(es)
|
||||||
end
|
end
|
||||||
ebullets:strip(function(eb)
|
ebullets:strip(function(eb)
|
||||||
-- loopify this when split moves implemented
|
local disposition
|
||||||
if (eb:move()) return true
|
repeat
|
||||||
if (not collides(pbox, hurtbox(eb))) return
|
disposition=eb:step()
|
||||||
ps:hitbullet(eb)
|
if collides(pbox, hurtbox(eb)) then
|
||||||
return eb:hitship(ps)
|
ps:hitbullet(eb)
|
||||||
|
if (eb:hitship(ps)) return true
|
||||||
|
end
|
||||||
|
until disposition
|
||||||
|
return disposition == "dead"
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
ebullets:strip(call_move)
|
ebullets:strip(function(eb) repeat until eb:step() end)
|
||||||
end
|
end
|
||||||
|
|
||||||
pbullets:strip(function(pb)
|
pbullets:strip(function(pb)
|
||||||
for es in eship_collider:iterate_collisions(hurtbox(pb)) do
|
local disposition
|
||||||
if (es:hitbullet(pb)) eship_collider:yoink(es)
|
repeat
|
||||||
if (pb:hitship(es)) return true
|
disposition=pb:step()
|
||||||
end
|
for es in eship_collider:iterate_collisions(hurtbox(pb)) do
|
||||||
|
if (es:hitbullet(pb)) eship_collider:yoink(es)
|
||||||
|
if (pb:hitship(es)) return true
|
||||||
|
end
|
||||||
|
until disposition
|
||||||
|
return disposition == "dead"
|
||||||
end)
|
end)
|
||||||
|
|
||||||
intangibles_fg:strip(call_move)
|
intangibles_fg:stripmove()
|
||||||
|
|
||||||
if waves_complete == 32767 and not eships.next and not ebullets.next and not events.next then
|
if waves_complete == 32767 and not eships.next and not ebullets.next and not events.next then
|
||||||
game_state = win
|
game_state = win
|
||||||
@ -684,9 +700,10 @@ end
|
|||||||
-- default: die, return true.
|
-- default: die, return true.
|
||||||
-- returns whether to delete
|
-- returns whether to delete
|
||||||
-- the bullet
|
-- the bullet
|
||||||
-- die -- on-removal event,
|
bullet_base = mknew{
|
||||||
-- default no-op
|
steps=1,
|
||||||
bullet_base = mknew{ }
|
current_step=0
|
||||||
|
}
|
||||||
|
|
||||||
gun_base = mknew{
|
gun_base = mknew{
|
||||||
shoot_ready = -32768,
|
shoot_ready = -32768,
|
||||||
@ -809,26 +826,32 @@ remainder:
|
|||||||
end
|
end
|
||||||
|
|
||||||
function bullet_base:hitship(_)
|
function bullet_base:hitship(_)
|
||||||
self:die()
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function bullet_base:die()
|
function bullet_base:step()
|
||||||
end
|
self.current_step=(self.current_step+1)%self.steps
|
||||||
|
|
||||||
function bullet_base:move()
|
|
||||||
self.x += self.dx
|
self.x += self.dx
|
||||||
self.y += self.dy
|
self.y += self.dy
|
||||||
if (self.f) self.f -= 1
|
if (self.f) self.f -= 1
|
||||||
if (self.y > 145) or (self.y < -64) or (self.f and self.f < 0) or (self.x > 256) or (self.x < -128) then
|
if ((self.y > 130) or (self.y < -self.height*8) or (self.f and self.f < 0) or (self.x > 128) or (self.x < -self.width*8)) return "dead"
|
||||||
self:die()
|
if (self.current_step == 0) return "stop"
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
warmpal = {
|
||||||
|
[0]=0,1,2,1,2,1,5,10,2,4,9,3,13,5,8,9
|
||||||
|
}
|
||||||
|
|
||||||
function bullet_base:draw()
|
function bullet_base:draw()
|
||||||
spr(self.sprite, self.x, self.y, self.width, self.height)
|
local s,bx,by,dx,dy,w,h,st = self.sprite,self.x,self.y,self.dx,self.dy,self.width,self.height,self.steps
|
||||||
|
if st > 1 then
|
||||||
|
pal(warmpal)
|
||||||
|
for n=st-1,1,-1 do
|
||||||
|
spr(s, bx-n*dx, by-n*dy, w, h)
|
||||||
|
end
|
||||||
|
pal()
|
||||||
|
end
|
||||||
|
spr(s, bx, by, w, h)
|
||||||
end
|
end
|
||||||
|
|
||||||
function bullet_base:spawn_at(x, y)
|
function bullet_base:spawn_at(x, y)
|
||||||
@ -892,44 +915,33 @@ end
|
|||||||
-->8
|
-->8
|
||||||
-- bullets and guns
|
-- bullets and guns
|
||||||
|
|
||||||
zap_e = mknew(bullet_base.new{
|
zap_p = mknew(bullet_base.new{
|
||||||
--shape
|
--shape
|
||||||
sprite = 9, --index of ammo sprite
|
sprite = 8, --index of ammo sprite
|
||||||
width = 1, --in 8x8 blocks
|
width = 0.25, --in 8x8 blocks
|
||||||
height = 1,
|
height = 0.25,
|
||||||
hurt = { -- hurtbox - where this ship can be hit
|
hurt = { -- hurtbox - where this ship can be hit
|
||||||
x_off = 0, -- upper left corner
|
x_off = 0, -- upper left corner
|
||||||
y_off = 0, -- relative to sprite
|
y_off = 0, -- relative to sprite
|
||||||
width = 2,
|
width = 2,
|
||||||
height = 8
|
height = 2,
|
||||||
},
|
},
|
||||||
x_off = 1, -- how to position by ship
|
x_off = 1, -- how to position by ship
|
||||||
y_off = 8,
|
y_off = 0,
|
||||||
|
steps=4,
|
||||||
damage = 1,
|
damage = 1,
|
||||||
|
|
||||||
hitship = const_fxn(true),
|
hitship = const_fxn(true),
|
||||||
|
|
||||||
category = enemy_blt_cat,
|
|
||||||
})
|
|
||||||
|
|
||||||
zap_p = mknew(zap_e.new{
|
|
||||||
sprite = 8,
|
|
||||||
y_off = 0,
|
|
||||||
category = player_blt_cat,
|
category = player_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
zap_gun_e = mknew(gun_base.new{
|
zap_gun_p = mknew(gun_base.new{
|
||||||
cooldown = 0x0.0020, -- frames between shots
|
|
||||||
veloc = 4,
|
|
||||||
munition = zap_e,
|
|
||||||
})
|
|
||||||
|
|
||||||
zap_gun_p = mknew(zap_gun_e.new{
|
|
||||||
icon = 19,
|
icon = 19,
|
||||||
munition = zap_p,
|
cooldown = 0x0.0020, -- frames between shots
|
||||||
veloc = 8,
|
veloc = 2,
|
||||||
aim = 0.25,
|
aim = 0.25,
|
||||||
|
munition = zap_p,
|
||||||
hdr = "mAIN gUN",
|
hdr = "mAIN gUN",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1061,8 +1073,8 @@ rate: 2/sec
|
|||||||
vulcan_e = mknew(bullet_base.new{
|
vulcan_e = mknew(bullet_base.new{
|
||||||
--shape
|
--shape
|
||||||
sprite = 21,
|
sprite = 21,
|
||||||
width = 1, --in 8x8 blocks
|
width = 0.125, --in 8x8 blocks
|
||||||
height = 1,
|
height = 0.5,
|
||||||
hurt = { -- hurtbox - where this ship can be hit
|
hurt = { -- hurtbox - where this ship can be hit
|
||||||
x_off = 0, -- upper left corner
|
x_off = 0, -- upper left corner
|
||||||
y_off = 0, -- relative to sprite
|
y_off = 0, -- relative to sprite
|
||||||
@ -1322,7 +1334,7 @@ chasey = mknew(ship_m.new{
|
|||||||
drag = 0.075,
|
drag = 0.075,
|
||||||
|
|
||||||
init = function(ship)
|
init = function(ship)
|
||||||
ship.main_gun=ship.main_gun or zap_gun_e.new{}
|
--ship.main_gun=ship.main_gun or zap_gun_e.new{}
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1768,7 +1780,6 @@ function xp_gem:draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function xp_gem:move()
|
function xp_gem:move()
|
||||||
|
|
||||||
if not primary_ship.dead and abs(self.x + 1 - primary_ship.x - primary_ship.hurt.x_off) <= primary_ship.magnet and abs(self.y + 1 - primary_ship.y - primary_ship.hurt.y_off) <= primary_ship.magnet then
|
if not primary_ship.dead and abs(self.x + 1 - primary_ship.x - primary_ship.hurt.x_off) <= primary_ship.magnet and abs(self.y + 1 - primary_ship.y - primary_ship.hurt.y_off) <= primary_ship.magnet then
|
||||||
if (self.x < primary_ship.x + 3) self.x += 1
|
if (self.x < primary_ship.x + 3) self.x += 1
|
||||||
if (self.x > primary_ship.x + 5) self.x -= 1
|
if (self.x > primary_ship.x + 5) self.x -= 1
|
||||||
@ -1778,9 +1789,6 @@ function xp_gem:move()
|
|||||||
return bullet_base.move(self)
|
return bullet_base.move(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- todo: "magnetic" behavior
|
|
||||||
-- when near player ship
|
|
||||||
|
|
||||||
function xp_gem:hitship(ship)
|
function xp_gem:hitship(ship)
|
||||||
if (ship ~= primary_ship or primary_ship.dead) return false
|
if (ship ~= primary_ship or primary_ship.dead) return false
|
||||||
primary_ship.xp += self.val
|
primary_ship.xp += self.val
|
||||||
@ -2024,14 +2032,14 @@ function rearm_mode:update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000000650000000000000000000bb0b50b59909209200cc0c00000000003b00000082000000e00e8002e00e800200333300002222000000000000000000
|
00000000000650000000000000000000bb0b50b59909209200cc0c00000000007b00000082000000e00e8002e00e800200333300002222000000000000000000
|
||||||
00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb0037000000a2000000e0e8880240e8480403bbbb30028888200000000000000000
|
00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb00bb000000a2000000e0e8880240e8480403bbbb30028888200000000000000000
|
||||||
00700700006d6500000000000cddddd00b33335009444420c00c000c0b333330b7000000a8000000e88e2882e48e24823bbaabb3288aa8820000000000000000
|
00700700006d6500000000000cddddd00b33335009444420c00c000c0b33333000000000a8000000e88e2882e48e24823bbaabb3288aa8820000000000000000
|
||||||
00077000067c665000000000cdd10cd10b3dd350094dd42000c0000cb3350b35b7000000a8000000e88e2882484e24423ba77ab328a77a820000000000000000
|
00077000067c665000000000cdd10cd10b3dd350094dd42000c0000cb3350b3500000000a8000000e88e2882484e24423ba77ab328a77a820000000000000000
|
||||||
00077000067d665000000000cd10cdd100b3350000944200c0000000b350b335b7000000a8000000e88e2882e84e28823ba77ab328a77a820000000000000000
|
00077000067d665000000000cd10cdd100b3350000944200c0000000b350b33500000000a8000000e88e2882e84e28823ba77ab328a77a820000000000000000
|
||||||
0070070065666765000000000ddddd100b33355009444220c000000c03333350b7000000a800000008888820048488203bbaabb3288aa8820000000000000000
|
0070070065666765000000000ddddd100b33355009444220c000000c0333335000000000a800000008888820048488203bbaabb3288aa8820000000000000000
|
||||||
000000006506506500000000001111000b0b5050090920200c0000c00055550037000000a2000000008882000048420003bbbb30028888200000000000000000
|
000000006506506500000000001111000b0b5050090920200c0000c00055550000000000a2000000008882000048420003bbbb30028888200000000000000000
|
||||||
00000000650000650000000000000000000b50000009200000c0cc00000000003b00000082000000000820000008200000333300002222000000000000000000
|
00000000650000650000000000000000000b50000009200000c0cc00000000000000000082000000000820000008200000333300002222000000000000000000
|
||||||
0000000000065000000650000003b0000070070080000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
0000000000065000000650000003b0000070070080000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
||||||
000000000067500000076500000370000005500080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
000000000067500000076500000370000005500080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
||||||
00000000006d6500006d6500000b7000700660079000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
00000000006d6500006d6500000b7000700660079000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
||||||
@ -2222,8 +2230,11 @@ __gff__
|
|||||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000212060a0e01091119000000000000002232363a3e050d151d
|
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000212060a0e01091119000000000000002232363a3e050d151d
|
||||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
__map__
|
__map__
|
||||||
00006b6b00006f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00006b6b00006f6a6a6a6a6a6a6a6a6a6a6a6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
7b6a00006a7b6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
7b6a00006a7b6e6a6a6a6a6a6a6a6a6a6a6a6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
7778686878776c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
7778686878776c6a6a6a6a6a6a6a6a6a6a6a6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
6767777767676c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
6767777767676c6a6a6a6a6a6a6a6a6a6a6a6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
7877676777787d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
7877676777787d6a6a6a6a6a6a6a6a6a6a6a6d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000006a6a6a6a6a6a6a6a6a6a6a6d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000006a6a6a6a6a6a6a6a6a6a6a6c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
000000000000006a6a6a6a6a6a6a6a6a6a6a7c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
Reference in New Issue
Block a user