Compare commits
31 Commits
gun_picker
...
267f8a3667
Author | SHA1 | Date | |
---|---|---|---|
267f8a3667
|
|||
fa206c37c5
|
|||
928e7f7418
|
|||
2439fda068
|
|||
d13290f438
|
|||
e3a2810f0a
|
|||
3764063b20
|
|||
90f6df2922
|
|||
b7c3e6ee92
|
|||
c91e5f4bd1
|
|||
ea2ddadb15
|
|||
9333c03bf3
|
|||
1b45bd3dc3
|
|||
71a7351d77
|
|||
80bb848468
|
|||
b227844d12
|
|||
ce14d03669
|
|||
ccd2c64103
|
|||
e5b8a30cb6
|
|||
7ed305d2d9
|
|||
288b7f64c8
|
|||
aea2a8c481
|
|||
9b24f10c23
|
|||
511c18f90e
|
|||
142810ee2d
|
|||
50beae1852
|
|||
9c95fc1784
|
|||
cb2d24c9d0
|
|||
67603f8496
|
|||
2cebea663f
|
|||
eed7b6af87
|
603
vacuum_gambit.p8
603
vacuum_gambit.p8
@ -126,8 +126,7 @@ end
|
||||
function _init()
|
||||
mode = game_mode
|
||||
init_blip_pals()
|
||||
wipe_level()
|
||||
primary_ship.main_gun = zap_gun_p.new() -- redundant?
|
||||
wipe_game() -- redundant?
|
||||
load_level(example_level_csv)
|
||||
game_state = game
|
||||
pal(2,129)
|
||||
@ -157,7 +156,7 @@ function init_hpcols()
|
||||
hpcols = hpcols_lut[min(primary_ship.maxhp,6)]
|
||||
end
|
||||
|
||||
function wipe_level()
|
||||
function wipe_game()
|
||||
xpwhoosh = nil
|
||||
primary_ship = player.new()
|
||||
init_hpcols()
|
||||
@ -170,6 +169,8 @@ function wipe_level()
|
||||
intangibles_bg = linked_list.new()
|
||||
events = linked_list.new()
|
||||
new_events = linked_list.new()
|
||||
primary_ship.main_gun = zap_gun_p.new()
|
||||
primary_ship.main_gun:peel()
|
||||
end
|
||||
|
||||
function _update60()
|
||||
@ -465,6 +466,14 @@ end
|
||||
-->8
|
||||
--ship behavior
|
||||
|
||||
-- generic full sprite hurtbox
|
||||
box8 = {
|
||||
x_off = 0,
|
||||
y_off = 1,
|
||||
width = 8,
|
||||
height = 8
|
||||
}
|
||||
|
||||
scrollrate = 0.25 --in px/frame
|
||||
|
||||
ship_m = mknew{
|
||||
@ -502,14 +511,14 @@ function ship_m:die()
|
||||
-- overage XP, min 100
|
||||
spawn_xp_at(cx, cy, 0, xp-0x0.018f)
|
||||
xp = 0x0.018f -- dec 399
|
||||
z += 1
|
||||
z += 2
|
||||
end
|
||||
-- 100, 25, 5, 1
|
||||
for gsz in all{0x0.0064, 0x0.0019, 0x0.0005, 0x0.0001} do
|
||||
while xp >= gsz do
|
||||
spawn_xp_at(cx, cy, z, gsz)
|
||||
xp -= gsz
|
||||
z += 1
|
||||
z += 2
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -611,30 +620,25 @@ end
|
||||
function ship_m:hitsomething(dmg)
|
||||
if (dmg <= 0) return false
|
||||
self.shield_refresh_ready = lframe + self.shieldpenalty
|
||||
if self.shield >= dmg then
|
||||
if self.shield > 0 then
|
||||
self.shield -= dmg
|
||||
self:ow(true)
|
||||
if self.shield > 0 then
|
||||
blip(self,12)
|
||||
else
|
||||
self.shield = 0
|
||||
blip(self,7)
|
||||
end
|
||||
return false
|
||||
end
|
||||
dmg -= self.shield
|
||||
self.shield = 0
|
||||
self.hp -= dmg
|
||||
if self.hp < 0 then
|
||||
self:die()
|
||||
return true
|
||||
end
|
||||
self:ow(false)
|
||||
blip(self, self.friendly and 8 or 7)
|
||||
return false
|
||||
end
|
||||
|
||||
function ship_m:ow(shielded)
|
||||
if (shielded) then
|
||||
blip(self,12,3)
|
||||
return
|
||||
end
|
||||
blip(self, 7, 3)
|
||||
end
|
||||
|
||||
function ship_m:refresh_shield()
|
||||
if (self.shield >= self.maxshield) return
|
||||
if (lframe < self.shield_refresh_ready) return
|
||||
@ -680,7 +684,13 @@ bullet_base = mknew{ }
|
||||
|
||||
gun_base = mknew{
|
||||
shoot_ready = -32768,
|
||||
icon = 20
|
||||
icon = 20,
|
||||
ammobonus = 1,
|
||||
|
||||
-- fractional frames of
|
||||
-- cooldown reduction from
|
||||
-- upgrades, not yet applied
|
||||
cd_remainder = 0,
|
||||
}
|
||||
|
||||
-- gun_base subtypes are
|
||||
@ -689,6 +699,7 @@ gun_base = mknew{
|
||||
-- themselves to the player
|
||||
function gun_base:action()
|
||||
local item = self.new()
|
||||
item:peel()
|
||||
item.ammo = item.maxammo
|
||||
if not primary_ship.special_guns then
|
||||
primary_ship.special_guns = {item}
|
||||
@ -697,6 +708,81 @@ function gun_base:action()
|
||||
end
|
||||
end
|
||||
|
||||
-- make shot type unique so
|
||||
-- stat modifications do not
|
||||
-- damage base data
|
||||
function gun_base:peel()
|
||||
self.munition = mknew(self.munition.new())
|
||||
end
|
||||
|
||||
-- default firing behavior:
|
||||
-- single shot
|
||||
function gun_base:actually_shoot(x, y)
|
||||
self.munition.new{}:spawn_at(x, y)
|
||||
end
|
||||
|
||||
-- upgrade
|
||||
function gun_base:small_upgrade_opts()
|
||||
local ret = {
|
||||
self:ammo_upgrade_opt(),
|
||||
self:rate_upgrade_opt(),
|
||||
}
|
||||
local s = self.special_upgrade_opt
|
||||
if (s) add(ret, s(self))
|
||||
return ret
|
||||
end
|
||||
|
||||
function gun_base:ammo_upgrade_opt()
|
||||
local a=self.maxammo
|
||||
local x=a\10+self.ammobonus
|
||||
return {
|
||||
icon=self.icon,
|
||||
hdr=self.hdr,
|
||||
body=[[--------AMMO
|
||||
|
||||
more shots
|
||||
before you
|
||||
run out.
|
||||
|
||||
is: ]]..tostr(a)..[[
|
||||
add: ]]..tostr(x)..[[
|
||||
----------
|
||||
total: ]]..tostr(a+x),
|
||||
action=function()
|
||||
self.maxammo+=x
|
||||
self.ammo+=x
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function gun_base:rate_upgrade_opt()
|
||||
local c=self.cooldown<<16
|
||||
local rawnewc=0.85*(c-self.cd_remainder)
|
||||
local newc=ceil(rawnewc)
|
||||
return {
|
||||
icon=self.icon,
|
||||
hdr=self.hdr,
|
||||
body=[[--------RATE
|
||||
|
||||
reduce delay
|
||||
between each
|
||||
shot when
|
||||
firing.
|
||||
|
||||
is: ]]..tostr(c)..[[f
|
||||
minus: ]]..tostr(c-newc)..[[f
|
||||
----------
|
||||
total: ]]..tostr(newc)..[[f
|
||||
|
||||
remainder:
|
||||
]]..sub(tostr(newc-rawnewc),0,5),
|
||||
action=function()
|
||||
self.cooldown=newc>>16
|
||||
self.cd_remainder=newc-rawnewc
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function bullet_base:hitship(_)
|
||||
self:die()
|
||||
return true
|
||||
@ -720,14 +806,6 @@ function bullet_base:draw()
|
||||
spr(self.sprite, self.x, self.y, self.width, self.height)
|
||||
end
|
||||
|
||||
-- An `actually_shoot` factory
|
||||
-- for trivial guns
|
||||
function spawn_one(t)
|
||||
return function(gun, x, y)
|
||||
t.new{}:spawn_at(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
function bullet_base:spawn_at(x, y)
|
||||
self.x = x - self.x_off
|
||||
self.y = y - self.y_off
|
||||
@ -780,11 +858,12 @@ zap_p = mknew(zap_e.new{
|
||||
|
||||
zap_gun_e = mknew(gun_base.new{
|
||||
cooldown = 0x0.0020, -- frames between shots
|
||||
actually_shoot = spawn_one(zap_e),
|
||||
munition = zap_e,
|
||||
})
|
||||
|
||||
zap_gun_p = mknew(zap_gun_e.new{
|
||||
actually_shoot = spawn_one(zap_p),
|
||||
icon = 19,
|
||||
munition = zap_p,
|
||||
hdr = "mAIN gUN",
|
||||
})
|
||||
|
||||
@ -843,12 +922,14 @@ blast_gun = mknew(gun_base.new{
|
||||
cooldown = 0x0.0078, -- 120 frames between shots
|
||||
ammo = 5,
|
||||
maxammo = 5,
|
||||
actually_shoot = spawn_one(blast),
|
||||
munition = blast,
|
||||
hdr = "bLASTER",
|
||||
body= [[plasma orb
|
||||
body= [[---------GUN
|
||||
|
||||
plasma orb
|
||||
cuts through
|
||||
enemies.
|
||||
slow.
|
||||
enemies.
|
||||
slow.
|
||||
|
||||
ammo: 5
|
||||
rate: 1/2sec
|
||||
@ -917,9 +998,11 @@ protron_gun_p = mknew(protron_gun_e.new{
|
||||
maxammo = 20,
|
||||
cooldown = 0x0.0018,
|
||||
hdr = "pROTRON",
|
||||
body = [[spray shots
|
||||
in a dense
|
||||
arc.
|
||||
body = [[---------GUN
|
||||
|
||||
spray shots
|
||||
in a dense
|
||||
arc.
|
||||
|
||||
ammo: 20
|
||||
rate: 2/sec
|
||||
@ -978,9 +1061,10 @@ vulcan_gun_p = mknew(vulcan_gun_e.new{
|
||||
munition=vulcan_p,
|
||||
maxammo = 100,
|
||||
hdr = "vULCAN",
|
||||
body = [[rapid fire
|
||||
in a v
|
||||
shape.
|
||||
body = [[---------GUN
|
||||
|
||||
rapidly fire
|
||||
in a v.
|
||||
|
||||
ammo: 100
|
||||
rate: 20/sec
|
||||
@ -995,6 +1079,7 @@ firespark = split"9, 8, 2, 5, 1"
|
||||
smokespark = split"13, 13, 5, 5"
|
||||
|
||||
player = mknew(ship_m.new{
|
||||
friendly=true,
|
||||
--shape
|
||||
sprite = 1, --index of ship sprite
|
||||
size = 1, --all ships are square; how many 8x8 sprites?
|
||||
@ -1019,6 +1104,7 @@ player = mknew(ship_m.new{
|
||||
xptarget = 0x0.0004,
|
||||
last_xp_frame = 0,
|
||||
level = 1,
|
||||
magnet = 10,
|
||||
|
||||
-- gun
|
||||
main_gun = nil, -- assign at spawn time
|
||||
@ -1031,10 +1117,10 @@ player = mknew(ship_m.new{
|
||||
y=96,
|
||||
xmomentum = 0,
|
||||
ymomentum = 0,
|
||||
maxspd = 2.5, -- momentum cap
|
||||
thrust = 0.25, -- momentum added from button
|
||||
maxspd = 1.5, -- momentum cap
|
||||
thrust = 0.1875, -- momentum added from button
|
||||
ymin = 0, ymax = 120, -- stay on screen
|
||||
drag = 0.125, -- momentum lost per frame
|
||||
drag = 0.0625, -- momentum lost per frame
|
||||
slip = false, -- does not slide down screen
|
||||
act = function(self) -- fetch buttons
|
||||
local b,th = btn(),self.thrust
|
||||
@ -1061,6 +1147,110 @@ player = mknew(ship_m.new{
|
||||
end,
|
||||
})
|
||||
|
||||
function player:small_upgrade_opts()
|
||||
local cdr, pr = (self.shieldcooldown - 0x0.000f) / 8, (self.shieldpenalty - 0x0.003c) / 9
|
||||
if (cdr == 0 and self.shieldcooldown > 0x0.000f) cdr = 0x0.0001
|
||||
if (pr == 0 and self.shieldpenalty > 0x0.003c) pr = 0x0.0001
|
||||
|
||||
local ret = {{
|
||||
icon=53,
|
||||
hdr="hull",
|
||||
body=[[--------SHIP
|
||||
|
||||
survive more
|
||||
unshielded
|
||||
hits.
|
||||
|
||||
+2 hp]],
|
||||
action=function()
|
||||
self.maxhp += 2
|
||||
self.hp += 2
|
||||
end,
|
||||
},{
|
||||
icon=52,
|
||||
hdr="capacity",
|
||||
body=[[------SHIELD
|
||||
|
||||
shield can
|
||||
absorb more
|
||||
hits before
|
||||
recharging.
|
||||
|
||||
+1 hp]],
|
||||
action=function()
|
||||
self.maxshield += 1
|
||||
self.shield += 1
|
||||
end,
|
||||
},{
|
||||
icon=1,
|
||||
hdr="thrusters",
|
||||
body=[[--------SHIP
|
||||
|
||||
move faster,
|
||||
steer more
|
||||
sharply.]],
|
||||
action=function()
|
||||
--maxspd thrust drag
|
||||
self.maxspd += 0.5
|
||||
self.thrust += 0.0625
|
||||
self.drag += 0.03125
|
||||
end,
|
||||
},{
|
||||
icon=20,
|
||||
hdr="magnet",
|
||||
body=[[--------SHIP
|
||||
|
||||
pick up xp
|
||||
from further
|
||||
away.]],
|
||||
action=function ()
|
||||
self.magnet += 2
|
||||
end,
|
||||
},
|
||||
self.main_gun:rate_upgrade_opt(),
|
||||
}
|
||||
|
||||
if cdr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "recharge",
|
||||
body=[[------SHIELD
|
||||
|
||||
shield will
|
||||
recharge at
|
||||
a faster
|
||||
pace.
|
||||
|
||||
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
|
||||
action = function()
|
||||
self.shieldcooldown -= cdr
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if pr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "recovery",
|
||||
body=[[------SHIELD
|
||||
|
||||
reduce the
|
||||
delay after
|
||||
a hit before
|
||||
shield will
|
||||
start to
|
||||
recharge.
|
||||
|
||||
]] .. tostr(ceil(100 * pr / self.shieldpenalty)) .. "% shorter",
|
||||
action = function()
|
||||
self.shieldpenalty -= pr
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
frownie = mknew(ship_m.new{
|
||||
--shape
|
||||
sprite = 3, --index of ship sprite
|
||||
@ -1165,7 +1355,6 @@ chasey = mknew(ship_m.new{
|
||||
end
|
||||
})
|
||||
|
||||
-- todo: use constraints
|
||||
function chasey:act()
|
||||
self.xmin = max(primary_ship.x-8, 0)
|
||||
self.xmax = min(primary_ship.x + 8, 112 - 8*self.size)
|
||||
@ -1203,6 +1392,53 @@ xl_chasey=mknew(chasey.new{
|
||||
end,
|
||||
})
|
||||
|
||||
-- flotilla ships
|
||||
|
||||
ship_f = mknew(ship_m.new{
|
||||
-- sprite required
|
||||
size = 1,
|
||||
hurt = box8,
|
||||
-- no sparks
|
||||
hp = 0.5,
|
||||
xp = 0x0.0001,
|
||||
|
||||
maxspd = 3,
|
||||
thrust = 0.1,
|
||||
drag = 0.05,
|
||||
slip = false,
|
||||
act = function(self)
|
||||
local wx,wy=self.want_x,self.want_y
|
||||
self.xmin,self.xmax,self.ymin,self.ymax = wx,wx,wy,wy
|
||||
return 0,0,false,false
|
||||
end,
|
||||
})
|
||||
|
||||
ship_mook = mknew(ship_f.new{
|
||||
sprite=103
|
||||
})
|
||||
ship_defender = mknew(ship_f.new{
|
||||
sprite=105,
|
||||
hp = 2.5,
|
||||
xp = 0x0.0003,
|
||||
})
|
||||
ship_turret = mknew(ship_f.new{
|
||||
sprite=106,
|
||||
xp = 0x0.0002,
|
||||
})
|
||||
ship_skirmisher = mknew(ship_f.new{
|
||||
sprite=107,
|
||||
xp = 0x0.0004,
|
||||
spark = smokespark,
|
||||
sparkodds = 4,
|
||||
})
|
||||
|
||||
function rnd_spawn_loc()
|
||||
local x,y = flr(rnd(304)), flr(rnd(32))
|
||||
if (x<184) return x-40,-y-8
|
||||
if (x<244) return -y-8,x-184
|
||||
return 112+y, x-244
|
||||
end
|
||||
|
||||
-->8
|
||||
-- collisions
|
||||
|
||||
@ -1267,6 +1503,161 @@ function collider:get_collisions(item)
|
||||
end
|
||||
return found
|
||||
end
|
||||
|
||||
-->8
|
||||
-- flotillas
|
||||
|
||||
-- a template for a wave, read
|
||||
-- from the map. each ship can
|
||||
-- alternate between "attack"
|
||||
-- and "formation" modes, like
|
||||
-- galaxian or galaga. ships
|
||||
-- with different roles have
|
||||
-- different rules for becoming
|
||||
-- aggressive, but aggression
|
||||
-- ramps up during the wave.
|
||||
|
||||
-- flotilla placeholders are
|
||||
-- defined by sprite flags.
|
||||
-- see obsidian vault for
|
||||
-- full docs.
|
||||
|
||||
flotilla = mknew{
|
||||
use_var = 0x0001,
|
||||
opt_odds = split"0.5,0.5,0.5,0.5",
|
||||
init=function(this)
|
||||
this.ship_bases={
|
||||
[0]=mknew(ship_mook.new{ship_t=0}),
|
||||
[1]=mknew(ship_mook.new{ship_t=1}),
|
||||
[4]=mknew(ship_defender.new{ship_t=4}),
|
||||
[5]=mknew(ship_defender.new{ship_t=5}),
|
||||
[8]=mknew(ship_turret.new{ship_t=8}),
|
||||
[9]=mknew(ship_turret.new{ship_t=9}),
|
||||
[12]=mknew(ship_skirmisher.new{ship_t=12}),
|
||||
[13]=mknew(ship_skirmisher.new{ship_t=13}),
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
function flotilla:load(ulc_cx, ulc_cy, lvl)
|
||||
local rows,cy,uv,counts={},ulc_cy,self.use_var+0xc840,{
|
||||
[0]=0,
|
||||
[1]=0,
|
||||
[4]=0,
|
||||
[5]=0,
|
||||
[8]=0,
|
||||
[9]=0,
|
||||
[12]=0,
|
||||
[13]=0,
|
||||
}
|
||||
repeat
|
||||
local row,cx,opt,f = {},ulc_cx,{},0
|
||||
for i,v in ipairs(self.opt_odds) do
|
||||
opt[i*4-4]=rnd()<v
|
||||
end
|
||||
repeat
|
||||
f=fget(mget(cx, cy))
|
||||
-- bits 0x03: control mark or ship?
|
||||
local mode = f&0x03
|
||||
if mode==2 then
|
||||
-- bits 0x0c: ship class
|
||||
local ship_t = f&0x0c
|
||||
-- bit 0x20: optional?
|
||||
if f&0x20 == 0 or opt[ship_t] then
|
||||
-- bit 0x10: alternate ship?
|
||||
-- increment ship id if
|
||||
-- alternate is requested
|
||||
-- and we allow alternates
|
||||
-- for this type of ship
|
||||
ship_t+=(uv>>ship_t&0x1)&(f&0x10>>4)
|
||||
add(row, self.ship_bases[ship_t]:new{col=cx-ulc_cx})
|
||||
end
|
||||
end
|
||||
until mode==1
|
||||
-- mode 1: end of line control mark
|
||||
-- bits 0x18: what size flotilla is this row used for?
|
||||
if (f&0x18)>>3 <= lvl then
|
||||
-- keep the row; count it
|
||||
for s in all(row) do
|
||||
counts[s.ship_t] += 1
|
||||
eships:push_back(s)
|
||||
end
|
||||
add(rows, row)
|
||||
end
|
||||
-- control mark bit 0x04: end of flotilla
|
||||
until f&0x04 == 1
|
||||
self.rows=rows
|
||||
self:statisfy(counts)
|
||||
end
|
||||
|
||||
function flotilla:statisfy(counts)
|
||||
-- TODO: now that we know how
|
||||
-- many ships of each kind
|
||||
-- exist, build ships to match
|
||||
-- difficulty target
|
||||
--
|
||||
-- no difficulty model is yet
|
||||
-- implemented, though, so
|
||||
-- just use base ships only
|
||||
-- for this prototype
|
||||
end
|
||||
|
||||
function flotilla:update()
|
||||
-- algorithm: redistribute
|
||||
-- TODO: alternate flotilla movement algorithms
|
||||
|
||||
-- find effective width and height
|
||||
local min_col,max_col,live_rows=999,0,0
|
||||
for row in all(self.rows) do
|
||||
local row_alive=false
|
||||
for ship in all(row) do
|
||||
if not ship.dead then
|
||||
row_alive=true
|
||||
local col=ship.col
|
||||
if (col < min_col) min_col = col
|
||||
if (col > max_col) max_col = col
|
||||
end
|
||||
end -- scanned row
|
||||
if (row_alive) live_rows += 1
|
||||
end -- extent search
|
||||
|
||||
if (live_rows == 0) return true -- done
|
||||
|
||||
-- distribute across box:
|
||||
-- x = [4, 100)
|
||||
-- y = [4, 80)
|
||||
|
||||
local x_interval,x_offset = 0,52
|
||||
if min_col < max_col then
|
||||
x_interval=96/(max_col-min_col)
|
||||
x_offset = 4-min_col*x_interval
|
||||
end
|
||||
|
||||
local y_interval,y_offset=0,40
|
||||
if live_rows > 1 then
|
||||
y_interval=76/(live_rows-1)
|
||||
x_offset=4-y_interval
|
||||
end
|
||||
|
||||
-- now assign target locations
|
||||
local real_row=0
|
||||
for row in all(self.rows) do
|
||||
local row_alive = false
|
||||
for ship in all(row) do
|
||||
if not ship.dead then
|
||||
if not row_alive then
|
||||
real_row += 1
|
||||
row_alive = true
|
||||
end
|
||||
ship.want_x = ship.col * x_interval - x_offset
|
||||
ship.want_y = real_row * y_interval - y_offset
|
||||
end -- ship updated
|
||||
end -- row updated
|
||||
end -- table updated
|
||||
|
||||
return false -- some ships remain
|
||||
end
|
||||
|
||||
-->8
|
||||
-- level and event system
|
||||
|
||||
@ -1471,6 +1862,18 @@ function multi(times, interval, fnm, ...)
|
||||
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.
|
||||
@ -1478,10 +1881,14 @@ end
|
||||
-- where offset,eol is a special case.
|
||||
|
||||
example_level_csv=[[1,spawn_frownie
|
||||
60,spawn_vulcan_chasey
|
||||
61,spawn_blocky
|
||||
85,spawn_spewy
|
||||
115,spawn_spewy
|
||||
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
|
||||
@ -1536,10 +1943,10 @@ function init_blip_pals()
|
||||
end
|
||||
end
|
||||
|
||||
function blip(obj, col, frames)
|
||||
function blip(obj, col)
|
||||
obj.fx_pal = blip_pals[col]
|
||||
if (obj.___fx_pal_event) obj.___fx_pal_event:abort()
|
||||
events:push_back(blip_fx.new{frames=frames, obj=obj})
|
||||
events:push_back(blip_fx.new{frames=3, obj=obj})
|
||||
end
|
||||
|
||||
bossspark = split"7,7,10,10,9,9,9,8,8,8,2,2,5,5"
|
||||
@ -1622,11 +2029,22 @@ function xp_gem:draw()
|
||||
)
|
||||
end
|
||||
|
||||
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 (self.x < primary_ship.x + 3) self.x += 1
|
||||
if (self.x > primary_ship.x + 5) self.x -= 1
|
||||
if (self.y < primary_ship.y + 3) self.y += 1
|
||||
if (self.y > primary_ship.y + 5) self.y -= 1
|
||||
end
|
||||
return bullet_base.move(self)
|
||||
end
|
||||
|
||||
-- todo: "magnetic" behavior
|
||||
-- when near player ship
|
||||
|
||||
function xp_gem:hitship(ship)
|
||||
if (ship ~= primary_ship) return false
|
||||
if (ship ~= primary_ship or primary_ship.dead) return false
|
||||
primary_ship.xp += self.val
|
||||
primary_ship.last_xp_frame = lframe
|
||||
return true
|
||||
@ -1698,18 +2116,13 @@ end
|
||||
|
||||
-- ordinary upgrades
|
||||
function small_opts()
|
||||
return {{
|
||||
icon=1,
|
||||
hdr="placeholder",
|
||||
body="placeholder",
|
||||
action = function() end,
|
||||
},
|
||||
{
|
||||
icon=1,
|
||||
hdr="placeholder",
|
||||
body="placeholder",
|
||||
action = function() end,
|
||||
}}
|
||||
-- todo: include gun opts
|
||||
if(not primary_ship.special_guns) return pick(primary_ship:small_upgrade_opts(), 2)
|
||||
local opts = {rnd(primary_ship:small_upgrade_opts())}
|
||||
for g in all(primary_ship.special_guns) do
|
||||
add(opts, rnd(g:small_upgrade_opts()))
|
||||
end
|
||||
return pick(opts, 2)
|
||||
end
|
||||
|
||||
-->8
|
||||
@ -1718,7 +2131,7 @@ end
|
||||
rearm_mode = mknew{
|
||||
sel=1,
|
||||
bfm=1,
|
||||
crt_frm = 1,
|
||||
crt_frm = 0,
|
||||
pos=-1,
|
||||
init=function(this)
|
||||
poke(0x5f5c, 255) --no btnp repeat
|
||||
@ -1733,7 +2146,7 @@ function rearm_mode:glow_box(x0, y0, x1, y1, c, cf)
|
||||
i -= 1
|
||||
rect(x0+i,y0+i,x1-i,y1-i,v)
|
||||
end
|
||||
fillp(crt[self.crt_frm&0xff])
|
||||
fillp(crt[1+(self.crt_frm&7)])
|
||||
rectfill(x0+4, y0+4, x1-4, y1-4, cf)
|
||||
fillp()
|
||||
end
|
||||
@ -1765,7 +2178,7 @@ end
|
||||
|
||||
function rearm_mode:draw_option(id)
|
||||
local rec = self.options[id]
|
||||
self:glow_box(0,0,55,100,self:frame_col(self.sel == id),1)
|
||||
self:glow_box(0,0,55,101,self:frame_col(self.sel == id),1)
|
||||
spr(rec.icon,5, 5)
|
||||
print(rec.hdr, 13, 8, 7)
|
||||
print(rec.body, 5, 15, 6)
|
||||
@ -1801,9 +2214,9 @@ function rearm_mode:draw()
|
||||
camera(frac * -128 + (1-frac) * -56, 0)
|
||||
self:draw_option(2)
|
||||
camera(0, -28 * frac)
|
||||
self:glow_box(0,101,111,127,self:frame_col(self.sel < 0),1)
|
||||
self:glow_box(0,102,111,127,self:frame_col(self.sel < 0),1)
|
||||
spr(96,15,107,4,2)
|
||||
print("full ammo\nfull shield\n+50% health",54, 106, 6)
|
||||
print("full ammo\nfull shield\n+50% health",54, 107, 6)
|
||||
end
|
||||
|
||||
function rearm_mode:update_pos()
|
||||
@ -1823,6 +2236,7 @@ function rearm_mode:update_pos()
|
||||
end
|
||||
|
||||
function rearm_mode:update()
|
||||
self.crt_frm+=0.25
|
||||
self:update_pos()
|
||||
if self.pos > 1 then
|
||||
mode = game_mode
|
||||
@ -1877,14 +2291,14 @@ __gfx__
|
||||
0070070065666765000000000ddddd100b33355009444220c000000c03333350b7000000a800000008888820048488203bbaabb3288aa8820000000000000000
|
||||
000000006506506500000000001111000b0b5050090920200c0000c00055550037000000a2000000008882000048420003bbbb30028888200000000000000000
|
||||
00000000650000650000000000000000000b50000009200000c0cc00000000003b00000082000000000820000008200000333300002222000000000000000000
|
||||
00000000000650000006500000000000b000000b80000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
||||
0000000000675000000765000000000000bbbb0080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
||||
00000000006d6500006d6500000000000b0000b09000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
||||
00000000067c6650067c6650000000000b0bb0b0a000000030000000033000000220000000576d009446544200000000c111111d067c66500000000000000000
|
||||
00000000067d6650067d6650000000000b0bb0b00000000000000000000000000000000000566d009244442200000000c111111d067d66500000000000000000
|
||||
000000005666657576667650000000000b0000b000000000000000000000000000000000000dd0009092220200000000c111111d656667650000000000000000
|
||||
0000000056565066665656500000000000bbbb0000000000000000000000000000000000000000000090020000000000c111111d650650650000000000000000
|
||||
00000000565000566500065000000000b000000b000000000000000000000000000000000000000000a00a0000000000cddddddd650000650000000000000000
|
||||
0000000000065000000650000003b0000070070080000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
||||
000000000067500000076500000370000005500080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
||||
00000000006d6500006d6500000b7000700660079000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
||||
00000000067c6650067c6650000b7000056ccd50a000000030000000033000000220000000576d009446544200000000c111111d067c66500000000000000000
|
||||
00000000067d6650067d6650000b7000056ccd500000000000000000000000000000000000566d009244442200000000c111111d067d66500000000000000000
|
||||
000000005666657576667650000b7000700dd00700000000000000000000000000000000000dd0009092220200000000c111111d656667650000000000000000
|
||||
000000005656506666565650000370000005500000000000000000000000000000000000000000000090020000000000c111111d650650650000000000000000
|
||||
0000000056500056650006500003b00000700700000000000000000000000000000000000000000000a00a0000000000cddddddd650000650000000000000000
|
||||
060007000600070006600770766c777c0000000000a0008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
6cd07cd06cd07cd06ccd7ccd6ccd7ccd000000000090008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0d000d006cd07cd06ccd7ccd6ccd7ccd0000000000800a0000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -1917,21 +2331,21 @@ cddddddddddd0000cddddddddddd0000cddddddddddd0000cddddddddddd0000cddddddddddd0000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
04444400044444440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
447777700477777a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
477aaa7a0477aaaa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a0047a047a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a0447a047a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a4477a047a44400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
477777a00477777a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
477770000422aaaa2222000200000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a77700022ee0002eeee002e00022e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a4777002ea2e002e002e02ee022ee0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a0477a22ea2e002e002e02e2e2e2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a0047a2e2222e02e222e02e02e02e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
47a0047a2eeeeeea2eeee002e02e02e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0aa000aa2e7aa2ea2e00e002e02e02e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
000000002e0002e02e002e02e02e02e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
044444000444444400000000000000000000000000000000000000000000000000000000000000000000000000000000000bb000000aa0000009900000088000
|
||||
447777700477777a0000000000000000000000000000000000000000000666000077700008888800000ab00006000060000bb000000aa0000009900000088000
|
||||
477aaa7a0477aaaa0000000000000000000000000000000000000000006ddd5007fff70008eeee20000ab00006c006d0000bb000000aa0000009900000088000
|
||||
47a0047a047a0000000000000000000000000000000000000000000006dd7d5007ffff4008eeee200aaabbb006ccccd0000bb000000aa0000009900000088000
|
||||
47a0447a047a0000000000000000000000000000000000000000000006d7dd5007ffff4008eeee200bbb333006ccccd0000bb000000aa0000009900000088000
|
||||
47a4477a047a4440000000000000000000000000000000000000000006ddd500004fff4008eeee20000b300006d00cd0000bb000000aa0000009900000088000
|
||||
477777a00477777a0000000000000000000000000000000000000000005550000004440002222200000b30000d0000d0000bb000000aa0000009900000088000
|
||||
477770000422aaaa22220002000002000000000000000000000000000000000000000000000000000000000000000000000bb000000aa0000009900000088000
|
||||
47a77700022ee0002eeee002e00022e00000000000000000000000000000000000000000000000000000000000000000000bb000000aa0000009900000088000
|
||||
47a4777002ea2e002e002e02ee022ee00000000000000000000000000005600000474000028282000004b000060000000bbbbbb00aaaaaa00999999008888880
|
||||
47a0477a22ea2e002e002e02e2e2e2e0000000000000000000000000005d0d0004f0f400080e0e00000a000000c000d00b0000b00a0000a00900009008000080
|
||||
47a0047a2e2222e02e222e02e02e02e000000000000000000000000005d07050070f0f2002e0e02004a0b0b0060c0c000b0bb0b00a0aa0a00909909008088080
|
||||
47a0047a2eeeeeea2eeee002e02e02e000000000000000000000000006070d1004f0f040080e0e000b0b035000c0c0d00b0bb0b00a0aa0a00909909008088080
|
||||
0aa000aa2e7aa2ea2e00e002e02e02e000000000000000000000000000d0d100002f0f2002e0e0200000300006000c000b0000b00a0000a00900009008000080
|
||||
000000002e0002e02e002e02e02e02e0000000000000000000000000000510000002420002020200000b5000000000d00bbbbbb00aaaaaa00999999008888880
|
||||
000000000e0000e00e000e00e00e00e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
__label__
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007777777777777777
|
||||
@ -2063,3 +2477,12 @@ __label__
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007666666666666665
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007555555555555555
|
||||
|
||||
__gff__
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000212060a0e01091119000000000000002232363a3e050d151d
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
__map__
|
||||
00006b6b00006f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7b6a00006a7b6e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7778686878776c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
6767777767676c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
7877676777787d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
Reference in New Issue
Block a user