Compare commits
2 Commits
d13290f438
...
928e7f7418
Author | SHA1 | Date | |
---|---|---|---|
928e7f7418
|
|||
2439fda068
|
@ -1403,7 +1403,7 @@ ship_f = mknew(ship_m.new{
|
|||||||
xp = 0x0.0001,
|
xp = 0x0.0001,
|
||||||
|
|
||||||
maxspd = 3,
|
maxspd = 3,
|
||||||
thrust = 0.15,
|
thrust = 0.1,
|
||||||
drag = 0.05,
|
drag = 0.05,
|
||||||
slip = false,
|
slip = false,
|
||||||
act = function(self)
|
act = function(self)
|
||||||
@ -1428,6 +1428,8 @@ ship_turret = mknew(ship_f.new{
|
|||||||
ship_skirmisher = mknew(ship_f.new{
|
ship_skirmisher = mknew(ship_f.new{
|
||||||
sprite=107,
|
sprite=107,
|
||||||
xp = 0x0.0004,
|
xp = 0x0.0004,
|
||||||
|
spark = smokespark,
|
||||||
|
sparkodds = 4,
|
||||||
})
|
})
|
||||||
|
|
||||||
function rnd_spawn_loc()
|
function rnd_spawn_loc()
|
||||||
@ -1520,6 +1522,89 @@ end
|
|||||||
-- see obsidian vault for
|
-- see obsidian vault for
|
||||||
-- full docs.
|
-- 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{column=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
|
||||||
|
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()
|
||||||
|
-- TODO: assign new want_x, want_y to everyone who isn't dead
|
||||||
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
-- level and event system
|
-- level and event system
|
||||||
|
|
||||||
@ -1747,10 +1832,10 @@ example_level_csv=[[1,spawn_frownie
|
|||||||
25,demo_spawn_f,ship_defender
|
25,demo_spawn_f,ship_defender
|
||||||
30,demo_spawn_f,ship_turret
|
30,demo_spawn_f,ship_turret
|
||||||
35,demo_spawn_f,ship_skirmisher
|
35,demo_spawn_f,ship_skirmisher
|
||||||
60,spawn_vulcan_chasey
|
80,spawn_vulcan_chasey
|
||||||
61,spawn_blocky
|
81,spawn_blocky
|
||||||
85,spawn_spewy
|
100,spawn_spewy
|
||||||
115,spawn_spewy
|
125,spawn_spewy
|
||||||
130,spawn_frownie
|
130,spawn_frownie
|
||||||
145,spawn_frownie
|
145,spawn_frownie
|
||||||
180,spawn_spewy
|
180,spawn_spewy
|
||||||
|
Reference in New Issue
Block a user