Compare commits
23 Commits
267f8a3667
...
trigenomet
Author | SHA1 | Date | |
---|---|---|---|
c514c61b3a
|
|||
9be828dd5c
|
|||
2b51a3472b
|
|||
95ea70baae
|
|||
b18b4f885d
|
|||
2fdb8d1a05
|
|||
fc1f84fa28
|
|||
93b63a5831
|
|||
297e6e4996
|
|||
9b3120c47b
|
|||
abee6d1206
|
|||
3151db5430
|
|||
2964159858
|
|||
95d4b6eb37
|
|||
96312e3adf
|
|||
bf9a45d87e
|
|||
36f7c6572f
|
|||
45b70d3aca
|
|||
35980d801a
|
|||
734811bd62
|
|||
4fddbea82c
|
|||
f675e31967
|
|||
0bd1463416
|
629
vacuum_gambit.p8
629
vacuum_gambit.p8
@ -29,23 +29,33 @@ end
|
|||||||
-- if tt.init is defined, generated
|
-- if tt.init is defined, generated
|
||||||
-- new calls tt.init(ret) after
|
-- new calls tt.init(ret) after
|
||||||
-- ret is definitely not nil,
|
-- ret is definitely not nil,
|
||||||
-- before calling setmetatable.
|
-- after calling setmetatable.
|
||||||
-- use to initialize mutables.
|
-- use to initialize mutables.
|
||||||
--
|
--
|
||||||
-- if there was a previous new,
|
-- if there was a previous new,
|
||||||
-- it is invoked on the new
|
-- it is invoked before
|
||||||
-- object *after* more, because
|
-- setting tt's metatable, so
|
||||||
-- this works better with the
|
-- each new will see its
|
||||||
-- `more` impls i use.
|
-- inheritance chain.
|
||||||
function mknew(tt)
|
function mknew(tt)
|
||||||
local mt,oldnew,more = {__index=tt},tt.new,rawget(tt, "init")
|
local mt,oldinit,more = {__index=tt},tt.superinit,rawget(tt, "init")
|
||||||
tt.new=function(ret)
|
tt.new=function(ret)
|
||||||
if(not ret) ret = {}
|
if(not ret) ret = {}
|
||||||
if(more) more(ret)
|
ret.new = false
|
||||||
if(oldnew) oldnew(ret)
|
|
||||||
setmetatable(ret, mt)
|
setmetatable(ret, mt)
|
||||||
|
if(oldinit) oldinit(ret)
|
||||||
|
if (more) more(ret)
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if oldinit and more then
|
||||||
|
tt.superinit = function(ret)
|
||||||
|
oldinit(ret)
|
||||||
|
more(ret)
|
||||||
|
end
|
||||||
|
elseif more then
|
||||||
|
tt.superinit = more
|
||||||
|
end
|
||||||
return tt
|
return tt
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -127,7 +137,6 @@ function _init()
|
|||||||
mode = game_mode
|
mode = game_mode
|
||||||
init_blip_pals()
|
init_blip_pals()
|
||||||
wipe_game() -- redundant?
|
wipe_game() -- redundant?
|
||||||
load_level(example_level_csv)
|
|
||||||
game_state = game
|
game_state = game
|
||||||
pal(2,129)
|
pal(2,129)
|
||||||
pal()
|
pal()
|
||||||
@ -171,6 +180,10 @@ function wipe_game()
|
|||||||
new_events = linked_list.new()
|
new_events = linked_list.new()
|
||||||
primary_ship.main_gun = zap_gun_p.new()
|
primary_ship.main_gun = zap_gun_p.new()
|
||||||
primary_ship.main_gun:peel()
|
primary_ship.main_gun:peel()
|
||||||
|
gframe = 0
|
||||||
|
interlude = 0
|
||||||
|
waves_complete = 0
|
||||||
|
current_wave = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function _update60()
|
function _update60()
|
||||||
@ -185,12 +198,44 @@ function call_move(x)
|
|||||||
return x:move()
|
return x:move()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ones(n)
|
||||||
|
local ret = 0
|
||||||
|
while n != 0 do
|
||||||
|
if (n&0x0.0001) ret += 1
|
||||||
|
n >>= 1
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
function updategame()
|
function updategame()
|
||||||
if (primary_ship.xp >= primary_ship.xptarget) and (lframe - primary_ship.last_xp_frame > 0x0.000f) and (not primary_ship.dead) then
|
if (primary_ship.xp >= primary_ship.xptarget) and (gframe - primary_ship.last_xp_frame > 0x0.000f) and (not primary_ship.dead) then
|
||||||
mode = rearm_mode.new()
|
mode = rearm_mode.new()
|
||||||
return _update60()
|
return _update60()
|
||||||
end
|
end
|
||||||
leveldone = level_frame()
|
gframe += 0x0.0001
|
||||||
|
if current_wave then
|
||||||
|
if current_wave:update() then
|
||||||
|
-- end of stage
|
||||||
|
waves_complete += 1
|
||||||
|
current_wave = nil
|
||||||
|
if waves_complete < 32767 then
|
||||||
|
interlude = 59 -- plus one dead frame with load_level but no update
|
||||||
|
else
|
||||||
|
-- you maxed out the level
|
||||||
|
-- counter. what the fuck
|
||||||
|
-- is wrong with you?
|
||||||
|
-- go outside.
|
||||||
|
--
|
||||||
|
-- do not spawn more levels.
|
||||||
|
interlude = 32767
|
||||||
|
end
|
||||||
|
end
|
||||||
|
elseif interlude > 0 then
|
||||||
|
interlude -= 1
|
||||||
|
else
|
||||||
|
current_wave = flotilla.new()
|
||||||
|
current_wave:load(0, 0, min(ones(waves_complete)\2, 4))
|
||||||
|
end
|
||||||
events:vore(new_events)
|
events:vore(new_events)
|
||||||
events:strip(call_move)
|
events:strip(call_move)
|
||||||
for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do
|
for _, lst in ipairs{intangibles_bg, pships, eships, pbullets, ebullets} do
|
||||||
@ -254,7 +299,7 @@ function updategame()
|
|||||||
|
|
||||||
intangibles_fg:strip(call_move)
|
intangibles_fg:strip(call_move)
|
||||||
|
|
||||||
if leveldone 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
|
||||||
end
|
end
|
||||||
if (not pships.next) game_state = lose
|
if (not pships.next) game_state = lose
|
||||||
@ -485,8 +530,6 @@ ship_m = mknew{
|
|||||||
shieldpenalty = 0x0.012c, --5s
|
shieldpenalty = 0x0.012c, --5s
|
||||||
shield_refresh_ready = 0,
|
shield_refresh_ready = 0,
|
||||||
|
|
||||||
slip = true, -- most enemies slide
|
|
||||||
|
|
||||||
xmomentum = 0,
|
xmomentum = 0,
|
||||||
ymomentum = 0,
|
ymomentum = 0,
|
||||||
|
|
||||||
@ -570,21 +613,13 @@ function ship_m:move()
|
|||||||
self:maybe_shoot(self.main_gun)
|
self:maybe_shoot(self.main_gun)
|
||||||
if (shoot_spec1 and self.special_guns) self:maybe_shoot(self.special_guns[1])
|
if (shoot_spec1 and self.special_guns) self:maybe_shoot(self.special_guns[1])
|
||||||
if (shoot_spec2 and self.special_guns) self:maybe_shoot(self.special_guns[2])
|
if (shoot_spec2 and self.special_guns) self:maybe_shoot(self.special_guns[2])
|
||||||
if (dx ~= 0 or dy ~= 0) spark(self.sparks, self.x + 4*self.size, self.y + 4*self.size, dx*2.5, dy*2.5, self.sparkodds)
|
spark(self.sparks, self.x + 4*self.size, self.y + 4*self.size, dx*2.5, dy*2.5, self.sparkodds)
|
||||||
self.xmomentum = self:calc_velocity(self.xmomentum, dx)
|
self.xmomentum = self:calc_velocity(self.xmomentum, dx)
|
||||||
self.ymomentum = self:calc_velocity(self.ymomentum, dy)
|
self.ymomentum = self:calc_velocity(self.ymomentum, dy)
|
||||||
|
|
||||||
self.x += self.xmomentum
|
self.x += self.xmomentum
|
||||||
self.y += self.ymomentum
|
self.y += self.ymomentum
|
||||||
|
|
||||||
-- "scrolling" behavior
|
|
||||||
if self.slip then
|
|
||||||
self.y += scrollrate
|
|
||||||
if self.y >= 128 then
|
|
||||||
self:die()
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -619,7 +654,7 @@ end
|
|||||||
|
|
||||||
function ship_m:hitsomething(dmg)
|
function ship_m:hitsomething(dmg)
|
||||||
if (dmg <= 0) return false
|
if (dmg <= 0) return false
|
||||||
self.shield_refresh_ready = lframe + self.shieldpenalty
|
self.shield_refresh_ready = gframe + self.shieldpenalty
|
||||||
if self.shield > 0 then
|
if self.shield > 0 then
|
||||||
self.shield -= dmg
|
self.shield -= dmg
|
||||||
if self.shield > 0 then
|
if self.shield > 0 then
|
||||||
@ -641,10 +676,10 @@ end
|
|||||||
|
|
||||||
function ship_m:refresh_shield()
|
function ship_m:refresh_shield()
|
||||||
if (self.shield >= self.maxshield) return
|
if (self.shield >= self.maxshield) return
|
||||||
if (lframe < self.shield_refresh_ready) return
|
if (gframe < self.shield_refresh_ready) return
|
||||||
self.shield += 1
|
self.shield += 1
|
||||||
self.shield = min(self.shield, self.maxshield)
|
self.shield = min(self.shield, self.maxshield)
|
||||||
self.shield_refresh_ready = lframe + self.shieldcooldown
|
self.shield_refresh_ready = gframe + self.shieldcooldown
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
@ -684,6 +719,10 @@ bullet_base = mknew{ }
|
|||||||
|
|
||||||
gun_base = mknew{
|
gun_base = mknew{
|
||||||
shoot_ready = -32768,
|
shoot_ready = -32768,
|
||||||
|
new_clip = -32768,
|
||||||
|
clip_size = false,
|
||||||
|
clip_remain = 0,
|
||||||
|
clip_interval = 0x0.80,
|
||||||
icon = 20,
|
icon = 20,
|
||||||
ammobonus = 1,
|
ammobonus = 1,
|
||||||
|
|
||||||
@ -691,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
|
||||||
@ -715,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 = {
|
||||||
@ -813,16 +867,57 @@ function bullet_base:spawn_at(x, y)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function gun_base:shoot(x, y)
|
function gun_base:shoot(x, y)
|
||||||
if (lframe < self.shoot_ready) return false
|
if (gframe < self.shoot_ready) return false
|
||||||
|
local csz,crm = self.clip_size, self.clip_remain
|
||||||
|
if csz then
|
||||||
|
if crm < csz and gframe >= self.new_clip then
|
||||||
|
self.clip_remain = csz
|
||||||
|
self.new_clip = gframe + self.clip_interval
|
||||||
|
elseif crm == 0 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
if self.ammo then
|
if self.ammo then
|
||||||
if (self.ammo <= 0) return false
|
if (self.ammo <= 0) return false
|
||||||
self.ammo -= 1
|
self.ammo -= 1
|
||||||
end
|
end
|
||||||
self.shoot_ready = lframe + self.cooldown
|
if csz then
|
||||||
|
self.clip_remain -= 1
|
||||||
|
end
|
||||||
|
self.shoot_ready = gframe + self.cooldown
|
||||||
self:actually_shoot(x, y)
|
self:actually_shoot(x, y)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function gun_base:actually_shoot(x, y)
|
||||||
|
local shots,veloc,aim,munition = self.shots,self.veloc,self.aim,self.munition
|
||||||
|
local idx = self.shot_idx % #shots + 1
|
||||||
|
self.shot_idx = idx
|
||||||
|
shots = shots[idx]
|
||||||
|
for s in all(shots) do
|
||||||
|
local a,xo,v = unpack(s)
|
||||||
|
v = v or veloc
|
||||||
|
xo = xo or 0
|
||||||
|
-- reverse x-offset for negative base angle
|
||||||
|
if (aim < 0) xo = -xo
|
||||||
|
a += aim
|
||||||
|
-- todo: switch munition
|
||||||
|
-- depending on angle
|
||||||
|
-- (allows for non-round
|
||||||
|
-- sprites and hitboxes on
|
||||||
|
-- shots from guns with
|
||||||
|
-- widely varying angles)
|
||||||
|
local m = munition.new{}
|
||||||
|
-- todo: automatically make
|
||||||
|
-- high velocity shots do
|
||||||
|
-- multiple collision checks
|
||||||
|
m.dy = sin(a) * veloc
|
||||||
|
m.dx = cos(a) * veloc
|
||||||
|
m:spawn_at(x+(xo or 0), y)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
-- bullets and guns
|
-- bullets and guns
|
||||||
|
|
||||||
@ -841,8 +936,6 @@ zap_e = mknew(bullet_base.new{
|
|||||||
y_off = 8,
|
y_off = 8,
|
||||||
|
|
||||||
damage = 1,
|
damage = 1,
|
||||||
dx = 0, -- px/frame
|
|
||||||
dy = 4,
|
|
||||||
|
|
||||||
hitship = const_fxn(true),
|
hitship = const_fxn(true),
|
||||||
|
|
||||||
@ -851,19 +944,21 @@ zap_e = mknew(bullet_base.new{
|
|||||||
|
|
||||||
zap_p = mknew(zap_e.new{
|
zap_p = mknew(zap_e.new{
|
||||||
sprite = 8,
|
sprite = 8,
|
||||||
dy = -8,
|
|
||||||
y_off = 0,
|
y_off = 0,
|
||||||
category = player_blt_cat,
|
category = player_blt_cat,
|
||||||
})
|
})
|
||||||
|
|
||||||
zap_gun_e = mknew(gun_base.new{
|
zap_gun_e = mknew(gun_base.new{
|
||||||
cooldown = 0x0.0020, -- frames between shots
|
cooldown = 0x0.0020, -- frames between shots
|
||||||
|
veloc = 4,
|
||||||
munition = zap_e,
|
munition = zap_e,
|
||||||
})
|
})
|
||||||
|
|
||||||
zap_gun_p = mknew(zap_gun_e.new{
|
zap_gun_p = mknew(zap_gun_e.new{
|
||||||
icon = 19,
|
icon = 19,
|
||||||
munition = zap_p,
|
munition = zap_p,
|
||||||
|
veloc = 8,
|
||||||
|
aim = 0.25,
|
||||||
hdr = "mAIN gUN",
|
hdr = "mAIN gUN",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -920,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,
|
||||||
@ -952,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,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -969,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
|
||||||
|
|
||||||
@ -1025,41 +1102,37 @@ 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
|
||||||
})
|
})
|
||||||
|
|
||||||
vulcan_gun_e = mknew(gun_base.new{
|
vulcan_gun_e = mknew(gun_base.new{
|
||||||
icon = 37,
|
icon = 37,
|
||||||
enemy = false,
|
|
||||||
cooldown = 0x0.0003, -- frames between shots
|
cooldown = 0x0.0003, -- frames between shots
|
||||||
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{
|
machine_gun_e = mknew(vulcan_gun_e.new{
|
||||||
dx = self.dxs[self.dxidx],
|
icon = 38,
|
||||||
}
|
clip_size = 12,
|
||||||
b:spawn_at(self.xoffs[self.dxidx]+x,y)
|
clip_interval = 0x0.005a,
|
||||||
self.dxidx += 1
|
shots = {{{0, 2}}, {{0, -2}}}
|
||||||
if (self.dxidx > #self.dxs) self.dxidx = 1
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@ -1121,7 +1194,6 @@ player = mknew(ship_m.new{
|
|||||||
thrust = 0.1875, -- momentum added from button
|
thrust = 0.1875, -- momentum added from button
|
||||||
ymin = 0, ymax = 120, -- stay on screen
|
ymin = 0, ymax = 120, -- stay on screen
|
||||||
drag = 0.0625, -- momentum lost per frame
|
drag = 0.0625, -- momentum lost per frame
|
||||||
slip = false, -- does not slide down screen
|
|
||||||
act = function(self) -- fetch buttons
|
act = function(self) -- fetch buttons
|
||||||
local b,th = btn(),self.thrust
|
local b,th = btn(),self.thrust
|
||||||
local blr = b&0x3
|
local blr = b&0x3
|
||||||
@ -1251,81 +1323,10 @@ shield will
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
frownie = mknew(ship_m.new{
|
-- original prototype leftover;
|
||||||
--shape
|
-- likely to be the basis of a
|
||||||
sprite = 3, --index of ship sprite
|
-- standard raider type, so
|
||||||
size = 1, --all ships are square; how many 8x8 sprites?
|
-- i am keeping it around
|
||||||
hurt = { -- hurtbox - where this ship can be hit
|
|
||||||
x_off = 0, -- upper left corner
|
|
||||||
y_off = 1, -- relative to ship ulc
|
|
||||||
width = 8,
|
|
||||||
height = 6
|
|
||||||
},
|
|
||||||
sparks = smokespark,
|
|
||||||
sparkodds = 8,
|
|
||||||
|
|
||||||
hp = 0.5, -- enemy ships need no max hp
|
|
||||||
xp = 0x0.0001,
|
|
||||||
|
|
||||||
-- position
|
|
||||||
x=60, -- x and y are for upper left corner
|
|
||||||
y=8,
|
|
||||||
xmomentum = 0,
|
|
||||||
ymomentum = 0,
|
|
||||||
maxspd = 2, -- momentum cap
|
|
||||||
thrust = 0.12, -- momentum added from button
|
|
||||||
drag = 0.07, -- momentum lost per frame
|
|
||||||
slip = true,
|
|
||||||
act = function(self)
|
|
||||||
local tstate,dx = (1 + flr(4*t() + 0.5)) % 6,0
|
|
||||||
if (tstate==1 or tstate==2) dx=-self.thrust
|
|
||||||
if (tstate>=4) dx=self.thrust
|
|
||||||
return dx,0,false,false
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
blocky = mknew(frownie.new{
|
|
||||||
sprite = 10,
|
|
||||||
hp = 1.5,
|
|
||||||
xp = 0x0.0002,
|
|
||||||
hurt = {
|
|
||||||
x_off = 0,
|
|
||||||
y_off = 0,
|
|
||||||
width = 8,
|
|
||||||
height = 7
|
|
||||||
},
|
|
||||||
|
|
||||||
ow = function(self)
|
|
||||||
if self.hp < 1 then
|
|
||||||
self.sprite = 11
|
|
||||||
else
|
|
||||||
self.sprite = 10
|
|
||||||
end
|
|
||||||
ship_m.ow(self)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
spewy = mknew(frownie.new{
|
|
||||||
sprite=26,
|
|
||||||
xp = 0x0.0003,
|
|
||||||
hurt = {
|
|
||||||
x_off=0,
|
|
||||||
y_off=1,
|
|
||||||
width=8,
|
|
||||||
height=5
|
|
||||||
},
|
|
||||||
hp=0.5,
|
|
||||||
fire_off_x=4,
|
|
||||||
fire_off_y=7,
|
|
||||||
act=function(self)
|
|
||||||
local dx,dy,shoot_spec=frownie.act(self)
|
|
||||||
return dx, dy, shoot_spec, self.y > 10
|
|
||||||
end,
|
|
||||||
init = function(ship)
|
|
||||||
ship.main_gun=ship.main_gun or protron_gun_e.new{}
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
chasey = mknew(ship_m.new{
|
chasey = mknew(ship_m.new{
|
||||||
sprite = 5,
|
sprite = 5,
|
||||||
xp = 0x0.0004,
|
xp = 0x0.0004,
|
||||||
@ -1348,7 +1349,6 @@ chasey = mknew(ship_m.new{
|
|||||||
maxspd = 2,
|
maxspd = 2,
|
||||||
thrust = 0.2,
|
thrust = 0.2,
|
||||||
drag = 0.075,
|
drag = 0.075,
|
||||||
slip = true,
|
|
||||||
|
|
||||||
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{}
|
||||||
@ -1376,7 +1376,6 @@ xl_chasey=mknew(chasey.new{
|
|||||||
hp = 19.5,
|
hp = 19.5,
|
||||||
shield = 5,
|
shield = 5,
|
||||||
boss = true,
|
boss = true,
|
||||||
slip = false,
|
|
||||||
act = function(self)
|
act = function(self)
|
||||||
local dx,dy,shoot_spec,shoot_main = chasey.act(self)
|
local dx,dy,shoot_spec,shoot_main = chasey.act(self)
|
||||||
if (self.y < 4) dy=self.thrust
|
if (self.y < 4) dy=self.thrust
|
||||||
@ -1387,9 +1386,6 @@ xl_chasey=mknew(chasey.new{
|
|||||||
sspr(40, 0, 8, 8, self.x, self.y, 16, 16)
|
sspr(40, 0, 8, 8, self.x, self.y, 16, 16)
|
||||||
pal()
|
pal()
|
||||||
end,
|
end,
|
||||||
init = function(ship)
|
|
||||||
ship.main_gun=ship.main_gun or zap_gun_e.new{}
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- flotilla ships
|
-- flotilla ships
|
||||||
@ -1401,16 +1397,20 @@ ship_f = mknew(ship_m.new{
|
|||||||
-- no sparks
|
-- no sparks
|
||||||
hp = 0.5,
|
hp = 0.5,
|
||||||
xp = 0x0.0001,
|
xp = 0x0.0001,
|
||||||
|
fire_off_x = 4,
|
||||||
|
fire_off_y = 4,
|
||||||
|
|
||||||
maxspd = 3,
|
maxspd = 3,
|
||||||
thrust = 0.1,
|
thrust = 0.1,
|
||||||
drag = 0.05,
|
drag = 0.05,
|
||||||
slip = false,
|
|
||||||
act = function(self)
|
act = function(self)
|
||||||
local wx,wy=self.want_x,self.want_y
|
local wx,wy=self.want_x,self.want_y
|
||||||
self.xmin,self.xmax,self.ymin,self.ymax = wx,wx,wy,wy
|
self.xmin,self.xmax,self.ymin,self.ymax = wx,wx,wy,wy
|
||||||
return 0,0,false,false
|
return 0,0,false,false
|
||||||
end,
|
end,
|
||||||
|
init = function(self)
|
||||||
|
if (self.gun_proto) self.main_gun = self.gun_proto.new()
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
ship_mook = mknew(ship_f.new{
|
ship_mook = mknew(ship_f.new{
|
||||||
@ -1424,12 +1424,14 @@ ship_defender = mknew(ship_f.new{
|
|||||||
ship_turret = mknew(ship_f.new{
|
ship_turret = mknew(ship_f.new{
|
||||||
sprite=106,
|
sprite=106,
|
||||||
xp = 0x0.0002,
|
xp = 0x0.0002,
|
||||||
|
gun_proto = machine_gun_e,
|
||||||
})
|
})
|
||||||
ship_skirmisher = mknew(ship_f.new{
|
ship_skirmisher = mknew(ship_f.new{
|
||||||
sprite=107,
|
sprite=107,
|
||||||
xp = 0x0.0004,
|
xp = 0x0.0004,
|
||||||
spark = smokespark,
|
sparks = smokespark,
|
||||||
sparkodds = 4,
|
sparkodds = 3,
|
||||||
|
fire_off_y = 7,
|
||||||
})
|
})
|
||||||
|
|
||||||
function rnd_spawn_loc()
|
function rnd_spawn_loc()
|
||||||
@ -1523,24 +1525,24 @@ end
|
|||||||
-- full docs.
|
-- full docs.
|
||||||
|
|
||||||
flotilla = mknew{
|
flotilla = mknew{
|
||||||
use_var = 0x0001,
|
use_var = 0x1111,
|
||||||
opt_odds = split"0.5,0.5,0.5,0.5",
|
opt_odds = split"0.5,0.5,0.5,0.5",
|
||||||
init=function(this)
|
init=function(this)
|
||||||
this.ship_bases={
|
this.ship_bases={
|
||||||
[0]=mknew(ship_mook.new{ship_t=0}),
|
[0]=mknew(ship_mook.new{ship_t=0}),
|
||||||
[1]=mknew(ship_mook.new{ship_t=1}),
|
[1]=mknew(ship_mook.new{ship_t=1, sprite=104}),
|
||||||
[4]=mknew(ship_defender.new{ship_t=4}),
|
[4]=mknew(ship_defender.new{ship_t=4}),
|
||||||
[5]=mknew(ship_defender.new{ship_t=5}),
|
[5]=mknew(ship_defender.new{ship_t=5, sprite=10}),
|
||||||
[8]=mknew(ship_turret.new{ship_t=8}),
|
[8]=mknew(ship_turret.new{ship_t=8}),
|
||||||
[9]=mknew(ship_turret.new{ship_t=9}),
|
[9]=mknew(ship_turret.new{ship_t=9, sprite=4}),
|
||||||
[12]=mknew(ship_skirmisher.new{ship_t=12}),
|
[12]=mknew(ship_skirmisher.new{ship_t=12}),
|
||||||
[13]=mknew(ship_skirmisher.new{ship_t=13}),
|
[13]=mknew(ship_skirmisher.new{ship_t=13, sprite=26}),
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
function flotilla:load(ulc_cx, ulc_cy, lvl)
|
function flotilla:load(ulc_cx, ulc_cy, lvl)
|
||||||
local rows,cy,uv,counts={},ulc_cy,self.use_var+0xc840,{
|
local rows,cy,uv,counts={},ulc_cy,self.use_var,{
|
||||||
[0]=0,
|
[0]=0,
|
||||||
[1]=0,
|
[1]=0,
|
||||||
[4]=0,
|
[4]=0,
|
||||||
@ -1551,14 +1553,14 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
|
|||||||
[13]=0,
|
[13]=0,
|
||||||
}
|
}
|
||||||
repeat
|
repeat
|
||||||
local row,cx,opt,f = {},ulc_cx,{},0
|
local row,cx,opt,f,mode= {},ulc_cx,{},0,0
|
||||||
for i,v in ipairs(self.opt_odds) do
|
for i,v in ipairs(self.opt_odds) do
|
||||||
opt[i*4-4]=rnd()<v
|
opt[i*4-4]=rnd()<v
|
||||||
end
|
end
|
||||||
repeat
|
repeat
|
||||||
f=fget(mget(cx, cy))
|
f=fget(mget(cx, cy))
|
||||||
-- bits 0x03: control mark or ship?
|
-- bits 0x03: control mark or ship?
|
||||||
local mode = f&0x03
|
mode = f&0x03
|
||||||
if mode==2 then
|
if mode==2 then
|
||||||
-- bits 0x0c: ship class
|
-- bits 0x0c: ship class
|
||||||
local ship_t = f&0x0c
|
local ship_t = f&0x0c
|
||||||
@ -1569,10 +1571,11 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
|
|||||||
-- alternate is requested
|
-- alternate is requested
|
||||||
-- and we allow alternates
|
-- and we allow alternates
|
||||||
-- for this type of ship
|
-- for this type of ship
|
||||||
ship_t+=(uv>>ship_t&0x1)&(f&0x10>>4)
|
ship_t+=(uv>>ship_t&0x1)&((f&0x10)>>4)
|
||||||
add(row, self.ship_bases[ship_t]:new{col=cx-ulc_cx})
|
add(row, self.ship_bases[ship_t].new{col=cx-ulc_cx})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
cx += 1
|
||||||
until mode==1
|
until mode==1
|
||||||
-- mode 1: end of line control mark
|
-- mode 1: end of line control mark
|
||||||
-- bits 0x18: what size flotilla is this row used for?
|
-- bits 0x18: what size flotilla is this row used for?
|
||||||
@ -1580,12 +1583,14 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
|
|||||||
-- keep the row; count it
|
-- keep the row; count it
|
||||||
for s in all(row) do
|
for s in all(row) do
|
||||||
counts[s.ship_t] += 1
|
counts[s.ship_t] += 1
|
||||||
|
s.x,s.y=rnd_spawn_loc()
|
||||||
eships:push_back(s)
|
eships:push_back(s)
|
||||||
end
|
end
|
||||||
add(rows, row)
|
add(rows, row)
|
||||||
end
|
end
|
||||||
|
cy += 1
|
||||||
-- control mark bit 0x04: end of flotilla
|
-- control mark bit 0x04: end of flotilla
|
||||||
until f&0x04 == 1
|
until f&0x04 > 0
|
||||||
self.rows=rows
|
self.rows=rows
|
||||||
self:statisfy(counts)
|
self:statisfy(counts)
|
||||||
end
|
end
|
||||||
@ -1625,7 +1630,7 @@ function flotilla:update()
|
|||||||
|
|
||||||
-- distribute across box:
|
-- distribute across box:
|
||||||
-- x = [4, 100)
|
-- x = [4, 100)
|
||||||
-- y = [4, 80)
|
-- y = [4, 60)
|
||||||
|
|
||||||
local x_interval,x_offset = 0,52
|
local x_interval,x_offset = 0,52
|
||||||
if min_col < max_col then
|
if min_col < max_col then
|
||||||
@ -1635,8 +1640,8 @@ function flotilla:update()
|
|||||||
|
|
||||||
local y_interval,y_offset=0,40
|
local y_interval,y_offset=0,40
|
||||||
if live_rows > 1 then
|
if live_rows > 1 then
|
||||||
y_interval=76/(live_rows-1)
|
y_interval=52/(live_rows-1)
|
||||||
x_offset=4-y_interval
|
y_offset=4-y_interval
|
||||||
end
|
end
|
||||||
|
|
||||||
-- now assign target locations
|
-- now assign target locations
|
||||||
@ -1649,8 +1654,8 @@ function flotilla:update()
|
|||||||
real_row += 1
|
real_row += 1
|
||||||
row_alive = true
|
row_alive = true
|
||||||
end
|
end
|
||||||
ship.want_x = ship.col * x_interval - x_offset
|
ship.want_x = ship.col * x_interval + x_offset
|
||||||
ship.want_y = real_row * y_interval - y_offset
|
ship.want_y = real_row * y_interval + y_offset
|
||||||
end -- ship updated
|
end -- ship updated
|
||||||
end -- row updated
|
end -- row updated
|
||||||
end -- table updated
|
end -- table updated
|
||||||
@ -1658,259 +1663,6 @@ function flotilla:update()
|
|||||||
return false -- some ships remain
|
return false -- some ships remain
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
|
||||||
-- level and event system
|
|
||||||
|
|
||||||
-- a level is a map from
|
|
||||||
-- effective frame number to
|
|
||||||
-- a list of actions for that
|
|
||||||
-- frame. an action is a
|
|
||||||
-- method name and its args.
|
|
||||||
|
|
||||||
-- effective frame number stops
|
|
||||||
-- when freeze count is nonzero
|
|
||||||
|
|
||||||
-- a level is won when it hits
|
|
||||||
-- the end-of-level sentinel
|
|
||||||
-- and there are no more
|
|
||||||
-- tracked enemies.
|
|
||||||
-- lost when there are no
|
|
||||||
-- player ships left.
|
|
||||||
|
|
||||||
-- effective frame
|
|
||||||
distance = 0
|
|
||||||
-- actual frame count since
|
|
||||||
-- start of level times 0x0.0001
|
|
||||||
lframe = 0
|
|
||||||
|
|
||||||
-- do not advance distance when
|
|
||||||
-- nonzero
|
|
||||||
freeze = 0
|
|
||||||
|
|
||||||
eol = {}
|
|
||||||
|
|
||||||
function load_level(levelfile)
|
|
||||||
distance = 0
|
|
||||||
lframe = 0
|
|
||||||
freeze = 0
|
|
||||||
leveldone = false
|
|
||||||
current_level = {}
|
|
||||||
local found_eol = false
|
|
||||||
if (type(levelfile)=="string") levelfile = csv(levelfile)
|
|
||||||
for row in all(levelfile) do
|
|
||||||
local x = current_level[row[1]]
|
|
||||||
if row[2] == "eol" then
|
|
||||||
found_eol = true
|
|
||||||
assert(x==nil, "events on eol frame")
|
|
||||||
current_level[row[1]] = eol
|
|
||||||
else
|
|
||||||
row.next = x
|
|
||||||
current_level[row[1]]=row
|
|
||||||
end
|
|
||||||
end
|
|
||||||
assert(found_eol)
|
|
||||||
end
|
|
||||||
|
|
||||||
function level_frame()
|
|
||||||
lframe += 0x0.0001
|
|
||||||
if (current_level == nil) return true
|
|
||||||
if freeze == 0 then
|
|
||||||
distance += 1
|
|
||||||
local cbs = current_level[distance]
|
|
||||||
if cbs ~= nil then
|
|
||||||
if cbs == eol then
|
|
||||||
current_level = nil
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
while cbs do
|
|
||||||
assert(cbs[1] == distance)
|
|
||||||
local f = _ENV[cbs[2]]
|
|
||||||
assert(type(f) == "function", cbs[2].." at "..distance.." is not a function")
|
|
||||||
f(unpack(cbs, 3))
|
|
||||||
cbs=cbs.next
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
-->8
|
|
||||||
-- example level
|
|
||||||
|
|
||||||
function spawn_blocking_rnd_x(typ)
|
|
||||||
freeze += 1
|
|
||||||
s = typ.new{
|
|
||||||
x = rnd(104),
|
|
||||||
y = -7,
|
|
||||||
ice = 1,
|
|
||||||
orig_die = typ.die,
|
|
||||||
die = function(self)
|
|
||||||
freeze -= self.ice
|
|
||||||
self.ice = 0
|
|
||||||
self:orig_die()
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
eships:push_back(s)
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_frownie()
|
|
||||||
return spawn_rnd(frownie)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_blocking_frownie()
|
|
||||||
spawn_blocking_rnd_x(frownie)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_blocky()
|
|
||||||
spawn_rnd(blocky)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_blocking_blocky()
|
|
||||||
spawn_rnd(blocky, 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_spewy()
|
|
||||||
return spawn_rnd(spewy)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_chasey()
|
|
||||||
return spawn_rnd(chasey)
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_blocking_spewy()
|
|
||||||
freeze += 1
|
|
||||||
local s = spawn_spewy()
|
|
||||||
s.ice = 1
|
|
||||||
s.die = function(self)
|
|
||||||
freeze -= self.ice
|
|
||||||
self.ice = 0
|
|
||||||
frownie.die(self)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function spawn_vulcan_chasey()
|
|
||||||
local c = spawn_chasey()
|
|
||||||
c.main_gun=vulcan_gun_e.new{enemy=true}
|
|
||||||
c.sprite=4
|
|
||||||
return c
|
|
||||||
end
|
|
||||||
|
|
||||||
helpers = {
|
|
||||||
spawn_frownie,
|
|
||||||
spawn_frownie,
|
|
||||||
spawn_frownie,
|
|
||||||
spawn_blocky,
|
|
||||||
spawn_blocky,
|
|
||||||
spawn_chasey,
|
|
||||||
spawn_spewy,
|
|
||||||
}
|
|
||||||
|
|
||||||
function spawn_blocking_boss_chasey()
|
|
||||||
local c = spawn_rnd(xl_chasey, 1)
|
|
||||||
local nextspawn = lframe + 0x0.0080
|
|
||||||
events:push_back{move=function()
|
|
||||||
if lframe >= nextspawn then
|
|
||||||
helpers[flr(rnd(#helpers))+1]()
|
|
||||||
nextspawn += 0x0.0040
|
|
||||||
end
|
|
||||||
return c.dead
|
|
||||||
end}
|
|
||||||
|
|
||||||
return c
|
|
||||||
end
|
|
||||||
|
|
||||||
function std_spawn(tnm, n, blocking, goodie,altspr)
|
|
||||||
local typ = _ENV[tnm]
|
|
||||||
assert(typ and typ.new, tostr(tnm).." not a class")
|
|
||||||
for i=1,(n or 1) do
|
|
||||||
spawn_rnd(typ, blocking, goodie,altspr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- blocking: 1 or 0
|
|
||||||
function spawn_rnd(typ, blocking, goodie,altspr)
|
|
||||||
blocking = blocking or 0
|
|
||||||
freeze += blocking
|
|
||||||
s = typ.new{
|
|
||||||
x = rnd(104),
|
|
||||||
y = -(typ.size * 8 - 1),
|
|
||||||
ice=blocking,
|
|
||||||
die=function(self)
|
|
||||||
freeze -= self.ice
|
|
||||||
self.ice=0
|
|
||||||
typ.die(self)
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
if (altspr) s.spr = altspr
|
|
||||||
eships:push_back(s)
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
function multi(times, interval, fnm, ...)
|
|
||||||
local f,irm,vargs = _ENV[fnm],interval,pack(...)
|
|
||||||
assert(type(f) == "function", fnm.." not a function")
|
|
||||||
f(...)
|
|
||||||
events:push_back{move=function()
|
|
||||||
irm-=1
|
|
||||||
if irm <= 0 then
|
|
||||||
irm=interval
|
|
||||||
times-=1
|
|
||||||
f(unpack(vargs))
|
|
||||||
return times <= 1
|
|
||||||
end
|
|
||||||
end}
|
|
||||||
end
|
|
||||||
|
|
||||||
function demo_spawn_f(ttn)
|
|
||||||
local spx,spy=rnd_spawn_loc()
|
|
||||||
local s = _ENV[ttn].new{
|
|
||||||
x = spx,
|
|
||||||
y = spy,
|
|
||||||
want_x = 8 + rnd(96),
|
|
||||||
want_y = 8 + rnd(64)
|
|
||||||
}
|
|
||||||
eships:push_back(s)
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
-- then convert sample_level to csv.
|
|
||||||
-- spawn_spec_gun_at and spawn_main_gun_at will need parsed forms.
|
|
||||||
-- the boss also needs to be reachable, but one-off is fine.
|
|
||||||
-- each row of level csv is offset,event,event-args...
|
|
||||||
-- where offset,eol is a special case.
|
|
||||||
|
|
||||||
example_level_csv=[[1,spawn_frownie
|
|
||||||
20,demo_spawn_f,ship_mook
|
|
||||||
25,demo_spawn_f,ship_defender
|
|
||||||
30,demo_spawn_f,ship_turret
|
|
||||||
35,demo_spawn_f,ship_skirmisher
|
|
||||||
80,spawn_vulcan_chasey
|
|
||||||
81,spawn_blocky
|
|
||||||
100,spawn_spewy
|
|
||||||
125,spawn_spewy
|
|
||||||
130,spawn_frownie
|
|
||||||
145,spawn_frownie
|
|
||||||
180,spawn_spewy
|
|
||||||
230,spawn_chasey
|
|
||||||
250,spawn_blocking_blocky
|
|
||||||
310,spawn_blocking_blocky
|
|
||||||
310,spawn_blocking_blocky
|
|
||||||
310,spawn_blocking_blocky
|
|
||||||
311,spawn_frownie
|
|
||||||
401,spawn_frownie
|
|
||||||
420,spawn_blocking_frownie
|
|
||||||
430,spawn_vulcan_chasey
|
|
||||||
450,spawn_frownie
|
|
||||||
465,spawn_frownie
|
|
||||||
480,spawn_chasey
|
|
||||||
500,multi,20,12,spawn_blocking_blocky
|
|
||||||
501,spawn_frownie
|
|
||||||
620,spawn_blocking_blocky
|
|
||||||
630,spawn_vulcan_chasey
|
|
||||||
720,spawn_blocking_boss_chasey
|
|
||||||
721,eol]]
|
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
-- standard events
|
-- standard events
|
||||||
|
|
||||||
@ -1981,15 +1733,15 @@ function spark_particle:draw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function spark(sprs, x, y, dx, dy, odds, fg)
|
function spark(sprs, x, y, dx, dy, odds, fg)
|
||||||
if (sprs==nil or flr(rnd(odds)) ~= 0) return
|
if (sprs==nil or flr(rnd(odds) or (abs(dx) < 0.5 and abs(dy))) ~= 0) return
|
||||||
local target = fg and intangibles_fg or intangibles_bg
|
local target = fg and intangibles_fg or intangibles_bg
|
||||||
target:push_back(spark_particle.new{
|
target:push_back(spark_particle.new{
|
||||||
x = x + rnd(4) - 2,
|
x = x + rnd(4) - 2,
|
||||||
y = y + rnd(4) - 2,
|
y = y + rnd(4) - 2,
|
||||||
sprs = sprs,
|
sprs = sprs,
|
||||||
sidx = 1,
|
sidx = 1,
|
||||||
dx = dx + rnd(2) - 1,
|
dx = dx * rnd(2),
|
||||||
dy = dy + rnd(2) - 1,
|
dy = dy * rnd(2),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
-->8
|
-->8
|
||||||
@ -2017,10 +1769,10 @@ function xp_gem:draw()
|
|||||||
-- sprite map position:
|
-- sprite map position:
|
||||||
-- sprite id to x and y,
|
-- sprite id to x and y,
|
||||||
-- offset shifts specific low
|
-- offset shifts specific low
|
||||||
-- bits of lframe up to the the
|
-- bits of gframe up to the the
|
||||||
-- bit with value 4 as a cheap
|
-- bit with value 4 as a cheap
|
||||||
-- way to pick an anim frame
|
-- way to pick an anim frame
|
||||||
if (lframe&0x0.003 == 0) qx, qy = (lframe&0x0.0004)<<16, (lframe&0x0.0008)<<15
|
if (gframe&0x0.003 == 0) qx, qy = (gframe&0x0.0004)<<16, (gframe&0x0.0008)<<15
|
||||||
sspr(
|
sspr(
|
||||||
(s%16<<3)+qx,
|
(s%16<<3)+qx,
|
||||||
(s\16<<3)+qy,
|
(s\16<<3)+qy,
|
||||||
@ -2046,7 +1798,7 @@ end
|
|||||||
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
|
||||||
primary_ship.last_xp_frame = lframe
|
primary_ship.last_xp_frame = gframe
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2095,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
|
||||||
|
|
||||||
@ -2116,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
|
||||||
@ -2197,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