3 Commits

Author SHA1 Message Date
6b5748dae7 bye, chasey!
chasey can be replaced by a path segment now
2025-07-06 22:28:41 -07:00
1d816e0c6a test player-relative paths 2025-07-06 21:07:36 -07:00
be321db355 mirror paths for skirmishers in the right half 2025-07-06 20:49:05 -07:00

View File

@@ -1407,71 +1407,6 @@ shield will
return ret
end
-- original prototype leftover;
-- likely to be the basis of a
-- standard raider type, so
-- i am keeping it around
chasey = mknew(ship_m.new{
sprite = 5,
xp = 0x0.0004,
size = 1,
hurt = {
x_off = 1,
y_off = 2,
width = 6,
height = 5,
},
sparks = smokespark,
sparkodds = 8,
hp = 1.5,
shield = 1,
maxshield = 1,
fire_off_x = 4,
fire_off_y = 7,
maxspd = 2,
thrust = 0.2,
drag = 0.075,
init = function(ship)
--ship.main_gun=ship.main_gun or zap_gun_e.new{}
end
})
function chasey:act()
self.xmin = max(primary_ship.x-8, 0)
self.xmax = min(primary_ship.x + 8, 112 - 8*self.size)
return 0, 0, false, self.y > 10 and self.x - 16 < primary_ship.x and self.x + 16 > primary_ship.x
end
xl_chasey=mknew(chasey.new{
size=2,
xp = 0x0.000a,
maxspd=1.25,
hurt = {
x_off = 2,
y_off = 4,
width = 12,
height = 10
},
fire_off_x = 8,
fire_off_y = 15,
hp = 19.5,
shield = 5,
boss = true,
act = function(self)
local dx,dy,shoot_spec,shoot_main = chasey.act(self)
if (self.y < 4) dy=self.thrust
return dx,dy,shoot_spec,shoot_main
end,
draw = function(self)
if(self.fx_pal) pal(self.fx_pal)
sspr(40, 0, 8, 8, self.x, self.y, 16, 16)
pal()
end,
})
-- flotilla ships
ship_f = mknew(ship_m.new{
@@ -1501,13 +1436,13 @@ ship_f = mknew(ship_m.new{
diamond_loop = segment.new{
dests = {
destination.new{
x_off_frac=0.25
x_off_frac=0.125
}, destination.new{
y_off_frac=0.25
y_off_frac=0.125
}, destination.new {
x_off_frac = -0.25
x_off_frac = -0.125
}, destination.new {
y_off_frac = -0.25
y_off_frac = -0.125
},
},
}
@@ -1529,6 +1464,37 @@ diamond_bounce = path.new{
},
}
swoop = segment.new {
dests = {
destination.new{
accel_frac = 0
}, destination.new{
x_off_frac = -0.75,
anchor_frac = 0.25,
}, destination.new {
x_off_frac = -0.375,
anchor_frac = 0.625,
}, destination.new {
y_off_frac = -0.125,
anchor_frac = 1,
}, destination.new {
x_off_frac = 0.375,
anchor_frac = 0.625,
},
},
}
swoop_loop = path.new {
segs = {
diamond_loop,
swoop,
park,
diamond_loop.mirror,
swoop.mirror,
park,
}
}
ship_mook = mknew(ship_f.new{
sprite=103
})
@@ -1545,12 +1511,13 @@ ship_turret = mknew(ship_f.new{
ship_skirmisher = mknew(ship_f.new{
sprite=107,
xp = 0x0.0004,
hp = 1.5,
sparks = smokespark,
sparkodds = 3,
fire_off_y = 7,
xmin = -8,
xmax = 112,
path = diamond_bounce,
path = swoop_loop,
})
function ship_skirmisher:reset_bounds()
@@ -1675,7 +1642,7 @@ flotilla = mknew{
[8]=mknew(ship_turret.new{ship_t=8}),
[9]=mknew(ship_turret.new{ship_t=9, sprite=4}),
[12]=mknew(ship_skirmisher.new{ship_t=12}),
[13]=mknew(ship_skirmisher.new{ship_t=13, sprite=26}),
[13]=mknew(ship_skirmisher.new{ship_t=13, sprite=26, path=diamond_bounce}),
}
end,
}
@@ -1691,8 +1658,9 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
[12]=0,
[13]=0,
}
local maxcol = 0
repeat
local row,cx,opt,f,mode= {},ulc_cx,{},0,0
local row,cx,opt,f,mode = {},ulc_cx,{},0,0
for i,v in ipairs(self.opt_odds) do
opt[i*4-4]=rnd()<v
end
@@ -1702,7 +1670,7 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
mode = f&0x03
if mode==2 then
-- bits 0x0c: ship class
local ship_t = f&0x0c
local ship_t, col = f&0x0c, cx-ulc_cx
-- bit 0x20: optional?
if f&0x20 == 0 or opt[ship_t] then
-- bit 0x10: alternate ship?
@@ -1711,7 +1679,8 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
-- 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})
add(row, self.ship_bases[ship_t].new{col=col})
if (col > maxcol) maxcol = col
end
end
cx += 1
@@ -1731,6 +1700,13 @@ function flotilla:load(ulc_cx, ulc_cy, lvl)
-- control mark bit 0x04: end of flotilla
until f&0x04 > 0
self.rows=rows
-- mirror right half paths; alternate center column if odd
local rh = maxcol>>1
for r, row in ipairs(rows) do
for s in all(row) do
if ((s.path) and (s.col > rh or (s.col == rh and r & 1 == 1))) s.path = s.path.mirror.new()
end
end
self:statisfy(counts)
end