Compare commits
4 Commits
b18b4f885d
...
trigenomet
Author | SHA1 | Date | |
---|---|---|---|
c514c61b3a
|
|||
9be828dd5c
|
|||
2b51a3472b
|
|||
95ea70baae
|
116
vacuum_gambit.p8
116
vacuum_gambit.p8
@ -730,6 +730,27 @@ gun_base = mknew{
|
|||||||
-- cooldown reduction from
|
-- cooldown reduction from
|
||||||
-- upgrades, not yet applied
|
-- upgrades, not yet applied
|
||||||
cd_remainder = 0,
|
cd_remainder = 0,
|
||||||
|
|
||||||
|
veloc = 1,
|
||||||
|
aim = 0.75, -- down; 0.25, or -0.75, is up
|
||||||
|
shot_idx = 0,
|
||||||
|
-- shots: list<list<[3]num>>
|
||||||
|
-- describing a cycling
|
||||||
|
-- firing pattern. shot_idx
|
||||||
|
-- tracks offset into pattern.
|
||||||
|
-- each nested list: a burst
|
||||||
|
-- of shots to fire; takes
|
||||||
|
-- 1 ammo; sequential
|
||||||
|
-- each shot: angle (turns,
|
||||||
|
-- relative to `aim`),
|
||||||
|
-- firing x-offset, velocity;
|
||||||
|
-- if x-offset is nil, use 0;
|
||||||
|
-- if velocity is nil, use
|
||||||
|
-- self.veloc instead
|
||||||
|
|
||||||
|
init = function(self)
|
||||||
|
if (not self.shots) self.shots = {{{0}}}
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- gun_base subtypes are
|
-- gun_base subtypes are
|
||||||
@ -754,12 +775,6 @@ function gun_base:peel()
|
|||||||
self.munition = mknew(self.munition.new())
|
self.munition = mknew(self.munition.new())
|
||||||
end
|
end
|
||||||
|
|
||||||
-- default firing behavior:
|
|
||||||
-- single shot
|
|
||||||
function gun_base:actually_shoot(x, y)
|
|
||||||
self.munition.new{}:spawn_at(x, y)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- upgrade
|
-- upgrade
|
||||||
function gun_base:small_upgrade_opts()
|
function gun_base:small_upgrade_opts()
|
||||||
local ret = {
|
local ret = {
|
||||||
@ -874,36 +889,17 @@ function gun_base:shoot(x, y)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
trig_gun = mknew(gun_base.new{
|
function gun_base:actually_shoot(x, y)
|
||||||
veloc = 1,
|
|
||||||
aim = 0.75, -- down; 0.25 is up
|
|
||||||
shot_idx = 0,
|
|
||||||
-- shots: list<list<[3]num>>
|
|
||||||
-- describing a cycling
|
|
||||||
-- firing pattern. shot_idx
|
|
||||||
-- tracks offset into pattern.
|
|
||||||
-- each nested list: a burst
|
|
||||||
-- of shots to fire; takes
|
|
||||||
-- 1 ammo; sequential
|
|
||||||
-- each shot: angle (turns,
|
|
||||||
-- relative to `aim`),
|
|
||||||
-- velocity, firing x-offset;
|
|
||||||
-- if velocity is nil, use
|
|
||||||
-- self.veloc instead;
|
|
||||||
-- if x-offset is nil, use 0
|
|
||||||
init = function(self)
|
|
||||||
if (not self.shots) self.shots = {{{0}}}
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
function trig_gun:actually_shoot(x, y)
|
|
||||||
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
|
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
|
||||||
local idx = self.shot_idx % #shots + 1
|
local idx = self.shot_idx % #shots + 1
|
||||||
self.shot_idx = idx
|
self.shot_idx = idx
|
||||||
shots = shots[idx]
|
shots = shots[idx]
|
||||||
for s in all(shots) do
|
for s in all(shots) do
|
||||||
local a,v,xo = unpack(s)
|
local a,xo,v = unpack(s)
|
||||||
v = v or veloc
|
v = v or veloc
|
||||||
|
xo = xo or 0
|
||||||
|
-- reverse x-offset for negative base angle
|
||||||
|
if (aim < 0) xo = -xo
|
||||||
a += aim
|
a += aim
|
||||||
-- todo: switch munition
|
-- todo: switch munition
|
||||||
-- depending on angle
|
-- depending on angle
|
||||||
@ -952,7 +948,7 @@ zap_p = mknew(zap_e.new{
|
|||||||
category = player_blt_cat,
|
category = player_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
zap_gun_e = mknew(trig_gun.new{
|
zap_gun_e = mknew(gun_base.new{
|
||||||
cooldown = 0x0.0020, -- frames between shots
|
cooldown = 0x0.0020, -- frames between shots
|
||||||
veloc = 4,
|
veloc = 4,
|
||||||
munition = zap_e,
|
munition = zap_e,
|
||||||
@ -1019,6 +1015,7 @@ blast = mknew(bullet_base.new{
|
|||||||
blast_gun = mknew(gun_base.new{
|
blast_gun = mknew(gun_base.new{
|
||||||
icon = 13,
|
icon = 13,
|
||||||
cooldown = 0x0.0078, -- 120 frames between shots
|
cooldown = 0x0.0078, -- 120 frames between shots
|
||||||
|
aim = -0.75,
|
||||||
ammo = 5,
|
ammo = 5,
|
||||||
maxammo = 5,
|
maxammo = 5,
|
||||||
munition = blast,
|
munition = blast,
|
||||||
@ -1051,8 +1048,6 @@ protron_e = mknew(bullet_base.new{
|
|||||||
y_off = 4,
|
y_off = 4,
|
||||||
|
|
||||||
damage = 1,
|
damage = 1,
|
||||||
dym = 0.5, -- gun sets dy;
|
|
||||||
-- this is mult
|
|
||||||
category = enemy_blt_cat,
|
category = enemy_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1068,34 +1063,17 @@ protron_gun_e = mknew(gun_base.new{
|
|||||||
cooldown = 0x0.0040, -- frames between shots
|
cooldown = 0x0.0040, -- frames between shots
|
||||||
ammo = nil,
|
ammo = nil,
|
||||||
maxammo = nil,
|
maxammo = nil,
|
||||||
munition = protron_e
|
munition = protron_e,
|
||||||
|
veloc = 2,
|
||||||
|
shots = {{{-0.25}, {-0.165}, {-0.0825}, {0}, {0.0825}, {0.165}, {0.25}}}
|
||||||
})
|
})
|
||||||
|
|
||||||
function protron_gun_e:actually_shoot(x, y)
|
|
||||||
local m = self.munition.dym
|
|
||||||
for i=1,3 do
|
|
||||||
local b = self.munition.new{
|
|
||||||
dx = i*m,
|
|
||||||
dy = (4-i)*m,
|
|
||||||
}
|
|
||||||
b:spawn_at(x,y)
|
|
||||||
local b2 = self.munition.new{
|
|
||||||
dx = -i*m,
|
|
||||||
dy = (4-i)*m,
|
|
||||||
}
|
|
||||||
b2:spawn_at(x,y)
|
|
||||||
end
|
|
||||||
local bup = self.munition.new{
|
|
||||||
dx=0,
|
|
||||||
dy=4*m,
|
|
||||||
}
|
|
||||||
bup:spawn_at(x,y)
|
|
||||||
end
|
|
||||||
|
|
||||||
protron_gun_p = mknew(protron_gun_e.new{
|
protron_gun_p = mknew(protron_gun_e.new{
|
||||||
munition = protron_p,
|
munition = protron_p,
|
||||||
maxammo = 20,
|
maxammo = 20,
|
||||||
cooldown = 0x0.0018,
|
cooldown = 0x0.0018,
|
||||||
|
veloc = 4,
|
||||||
|
aim = -0.75,
|
||||||
hdr = "pROTRON",
|
hdr = "pROTRON",
|
||||||
body = [[---------GUN
|
body = [[---------GUN
|
||||||
|
|
||||||
@ -1124,15 +1102,12 @@ vulcan_e = mknew(bullet_base.new{
|
|||||||
y_off = 0,
|
y_off = 0,
|
||||||
|
|
||||||
damage = 0.5,
|
damage = 0.5,
|
||||||
-- dx from gun
|
|
||||||
dy = 2,
|
|
||||||
category=enemy_blt_cat
|
category=enemy_blt_cat
|
||||||
})
|
})
|
||||||
|
|
||||||
vulcan_p = mknew(vulcan_e.new{
|
vulcan_p = mknew(vulcan_e.new{
|
||||||
sprite=22,
|
sprite=22,
|
||||||
y_off = 4,
|
y_off = 4,
|
||||||
dy = -4,
|
|
||||||
category=player_blt_cat
|
category=player_blt_cat
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1142,30 +1117,22 @@ vulcan_gun_e = mknew(gun_base.new{
|
|||||||
ammo = nil,
|
ammo = nil,
|
||||||
maxammo = nil,
|
maxammo = nil,
|
||||||
munition=vulcan_e,
|
munition=vulcan_e,
|
||||||
dxs = {0.35, -0.35, -0.7, 0.7, 0.35, -0.35},
|
veloc = 2,
|
||||||
xoffs = {1, 0, -1, 1, 0, -1},
|
shots = {{{0.02, 2}}, {{-0.02,0}}, {{-0.03, -2}}, {{0.03, 2}}, {{0.02, 0}}, {{-0.02, -2}}}
|
||||||
dxidx = 1,
|
|
||||||
actually_shoot = function(self, x, y)
|
|
||||||
local b = self.munition.new{
|
|
||||||
dx = self.dxs[self.dxidx],
|
|
||||||
}
|
|
||||||
b:spawn_at(self.xoffs[self.dxidx]+x,y)
|
|
||||||
self.dxidx += 1
|
|
||||||
if (self.dxidx > #self.dxs) self.dxidx = 1
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
machine_gun_e = mknew(vulcan_gun_e.new{
|
machine_gun_e = mknew(vulcan_gun_e.new{
|
||||||
icon = 38,
|
icon = 38,
|
||||||
clip_size = 12,
|
clip_size = 12,
|
||||||
clip_interval = 0x0.005a,
|
clip_interval = 0x0.005a,
|
||||||
dxs = {0, 0},
|
shots = {{{0, 2}}, {{0, -2}}}
|
||||||
xoffs = {1, -1},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
vulcan_gun_p = mknew(vulcan_gun_e.new{
|
vulcan_gun_p = mknew(vulcan_gun_e.new{
|
||||||
munition=vulcan_p,
|
munition=vulcan_p,
|
||||||
maxammo = 100,
|
maxammo = 100,
|
||||||
|
aim=-0.75,
|
||||||
|
veloc=4,
|
||||||
hdr = "vULCAN",
|
hdr = "vULCAN",
|
||||||
body = [[---------GUN
|
body = [[---------GUN
|
||||||
|
|
||||||
@ -1880,6 +1847,7 @@ end
|
|||||||
|
|
||||||
-- add a new gun
|
-- add a new gun
|
||||||
function spec_gun_opts()
|
function spec_gun_opts()
|
||||||
|
-- todo: avoid duplicates
|
||||||
return pick(spec_gunt, 2)
|
return pick(spec_gunt, 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1901,7 +1869,6 @@ end
|
|||||||
|
|
||||||
-- ordinary upgrades
|
-- ordinary upgrades
|
||||||
function small_opts()
|
function small_opts()
|
||||||
-- todo: include gun opts
|
|
||||||
if(not primary_ship.special_guns) return pick(primary_ship:small_upgrade_opts(), 2)
|
if(not primary_ship.special_guns) return pick(primary_ship:small_upgrade_opts(), 2)
|
||||||
local opts = {rnd(primary_ship:small_upgrade_opts())}
|
local opts = {rnd(primary_ship:small_upgrade_opts())}
|
||||||
for g in all(primary_ship.special_guns) do
|
for g in all(primary_ship.special_guns) do
|
||||||
@ -1982,7 +1949,10 @@ function rearm_mode:shuffle()
|
|||||||
-- until the upgrade deck
|
-- until the upgrade deck
|
||||||
-- is a thing that exists
|
-- is a thing that exists
|
||||||
local lev = primary_ship.level + 1
|
local lev = primary_ship.level + 1
|
||||||
if lev == 4 or lev == 12 then
|
|
||||||
|
-- for testing: more guns really early
|
||||||
|
-- if lev == 4 or lev == 12 then
|
||||||
|
if lev == 2 or lev == 3 then
|
||||||
self.options = spec_gun_opts()
|
self.options = spec_gun_opts()
|
||||||
elseif lev % 4 == 0 then
|
elseif lev % 4 == 0 then
|
||||||
self.options = big_opts()
|
self.options = big_opts()
|
||||||
|
Reference in New Issue
Block a user