Compare commits
3 Commits
a5ce0fd020
...
5634fcf4a4
Author | SHA1 | Date | |
---|---|---|---|
5634fcf4a4 | |||
447a1bedd0 | |||
0f7c7a810b |
109
updatedshmup.p8
109
updatedshmup.p8
@ -123,8 +123,7 @@ function _init()
|
|||||||
primary_ship.main_gun = zap_gun.new()
|
primary_ship.main_gun = zap_gun.new()
|
||||||
load_level(example_level)
|
load_level(example_level)
|
||||||
state = game
|
state = game
|
||||||
pal(2,129)
|
pal(0)
|
||||||
pal()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function once_next_frame(f)
|
function once_next_frame(f)
|
||||||
@ -136,23 +135,8 @@ function once_next_frame(f)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- health gradients for 1..5 hp
|
|
||||||
-- exactly, then all "more".
|
|
||||||
hpcols_lut = csv[[36
|
|
||||||
34, 136
|
|
||||||
34, 130, 136
|
|
||||||
34, 34, 130, 136
|
|
||||||
34, 34, 130, 130, 136]]
|
|
||||||
|
|
||||||
-- call after any change to maxhp
|
|
||||||
-- configures health gradient
|
|
||||||
function init_hpcols()
|
|
||||||
hpcols = hpcols_lut[min(primary_ship.maxhp,6)]
|
|
||||||
end
|
|
||||||
|
|
||||||
function wipe_level()
|
function wipe_level()
|
||||||
primary_ship = player.new()
|
primary_ship = player.new()
|
||||||
init_hpcols()
|
|
||||||
pships = linked_list.new()
|
pships = linked_list.new()
|
||||||
pships:push_back(primary_ship)
|
pships:push_back(primary_ship)
|
||||||
eships = linked_list.new()
|
eships = linked_list.new()
|
||||||
@ -247,6 +231,17 @@ function updategame()
|
|||||||
if (not pships.next) state = lose
|
if (not pships.next) state = lose
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function parse_pal(str)
|
||||||
|
local ret = split(str)
|
||||||
|
for i=0,15 do
|
||||||
|
ret[i]=ret[i+1]
|
||||||
|
end
|
||||||
|
ret[16] = nil
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
mainpal = parse_pal"0,134,141,138,4,5,6,7,8,9,10,11,12,13,8,12"
|
||||||
|
|
||||||
function _draw()
|
function _draw()
|
||||||
fillp(0)
|
fillp(0)
|
||||||
drawgame()
|
drawgame()
|
||||||
@ -312,6 +307,8 @@ function pukeboard(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function drawgame()
|
function drawgame()
|
||||||
|
pal(0)
|
||||||
|
pal(mainpal, 1)
|
||||||
clip(0,0,112,128)
|
clip(0,0,112,128)
|
||||||
rectfill(0,0,112,128,0)
|
rectfill(0,0,112,128,0)
|
||||||
for slist in all{intangibles_bg, pbullets, pships, eships, ebullets, intangibles_fg} do
|
for slist in all{intangibles_bg, pbullets, pships, eships, ebullets, intangibles_fg} do
|
||||||
@ -321,7 +318,6 @@ function drawgame()
|
|||||||
drawhud()
|
drawhud()
|
||||||
end
|
end
|
||||||
|
|
||||||
powcols=split"170,154,153,148,68"
|
|
||||||
function drawhud()
|
function drawhud()
|
||||||
-- 112-and-right is hud zone
|
-- 112-and-right is hud zone
|
||||||
rectfill(112, 0, 127, 127,0x56)
|
rectfill(112, 0, 127, 127,0x56)
|
||||||
@ -334,17 +330,15 @@ function drawhud()
|
|||||||
|
|
||||||
dropshadow("pwr",114,59,1)
|
dropshadow("pwr",114,59,1)
|
||||||
inset(114,66,125,92)
|
inset(114,66,125,92)
|
||||||
fillp(0x5a5a)
|
vertmeter(115,67,124,91,primary_ship.power, primary_ship.max_power, 9,8)
|
||||||
vertmeter(115,67,124,91,primary_ship.power, primary_ship.max_power, powcols)
|
|
||||||
|
|
||||||
|
|
||||||
dropshadow("h s",114,97,1)
|
dropshadow("h s",114,97,1)
|
||||||
inset(114,104,125,125)
|
inset(114,104,125,125)
|
||||||
line(119,105,119,124,119)
|
line(119,105,119,124,119)
|
||||||
line(120,105,120,125,85)
|
line(120,105,120,125,85)
|
||||||
vertmeter(115,105,118,124,primary_ship.hp, primary_ship.maxhp, hpcols)
|
vertmeter(115,105,118,124,primary_ship.hp, primary_ship.maxhp, 8,3)
|
||||||
vertmeter(121,105,124,124,primary_ship.shield, primary_ship.maxshield,{204,220,221})
|
vertmeter(121,105,124,124,primary_ship.shield, primary_ship.maxshield,12,3)
|
||||||
fillp(0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_gun_info(lbl,fgc,x,y,gun)
|
function draw_gun_info(lbl,fgc,x,y,gun)
|
||||||
@ -369,18 +363,15 @@ function draw_gun_info(lbl,fgc,x,y,gun)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function vertmeter(x0,y0,x1,y1,val,maxval,cols)
|
function vertmeter(x0,y0,x1,y1,val,maxval,col,seg)
|
||||||
if (val <= 0) return
|
if (val <= 0) return
|
||||||
local h = y1-y0
|
local h = y1-y0+1
|
||||||
local px = -flr(-(h*val)\maxval)
|
local per_seg = ceil((h+1)/seg) - 1
|
||||||
local ncols = #cols
|
local px = (h-seg+1)*val\maxval
|
||||||
local firstcol = ((h-px)*ncols\h)+1
|
while px > 0 do
|
||||||
local lastbottom = y0+(h*firstcol\ncols)
|
rectfill (x0, y1-min(px, per_seg)+1, x1, y1, col)
|
||||||
rectfill(x0, y1-px, x1, lastbottom, cols[firstcol])
|
px -= per_seg
|
||||||
for i=firstcol+1,ncols do
|
y1 -= per_seg+1
|
||||||
local bottom = y0+h*i\ncols
|
|
||||||
rectfill(x0,lastbottom,x1,bottom,cols[i])
|
|
||||||
lastbottom = bottom
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -486,7 +477,7 @@ end
|
|||||||
function ship_m:draw()
|
function ship_m:draw()
|
||||||
if(self.fx_pal) pal(self.fx_pal)
|
if(self.fx_pal) pal(self.fx_pal)
|
||||||
spr(self.sprite, self.x, self.y, self.size, self.size)
|
spr(self.sprite, self.x, self.y, self.size, self.size)
|
||||||
pal()
|
pal(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function hurtbox(ship)
|
function hurtbox(ship)
|
||||||
@ -771,7 +762,7 @@ function spawn_xl_chasey_at(x, y)
|
|||||||
draw = function(self)
|
draw = function(self)
|
||||||
if(self.fx_pal) pal(self.fx_pal)
|
if(self.fx_pal) pal(self.fx_pal)
|
||||||
sspr(40, 0, 8, 8, self.x, self.y, 16, 16)
|
sspr(40, 0, 8, 8, self.x, self.y, 16, 16)
|
||||||
pal()
|
pal(0)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
eships:push_back(c)
|
eships:push_back(c)
|
||||||
@ -1939,29 +1930,29 @@ function spawn_spec_gun_at(x, y, gunt)
|
|||||||
draw = function(self)
|
draw = function(self)
|
||||||
pal(spec_gun_pl)
|
pal(spec_gun_pl)
|
||||||
powerup.draw(self)
|
powerup.draw(self)
|
||||||
pal()
|
pal(0)
|
||||||
spr(self.gun.icon, self.x+2, self.y+2, 1, 1)
|
spr(self.gun.icon, self.x+2, self.y+2, 1, 1)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
gun_p:spawn_at(x, y)
|
gun_p:spawn_at(x, y)
|
||||||
end
|
end
|
||||||
__gfx__
|
__gfx__
|
||||||
00000000000650000000000000000000bb0b50b59909209200cc0c00000000003b00000082000000e00e8002e00e800200333300002222000000000000000000
|
00000000000650000000000000000000d20d20d2d20d20d200cc0c00000000004b00000098000000600661011006610100444400002222000000000000000000
|
||||||
00000000006765000000000000cccc00b50b3055920940220c0000c000bbbb0037000000a2000000e0e8880240e8480403bbbb30028888200000000000000000
|
00000000006765000000000000777700d20dd022d20dd0220c0000c000cccc0043000000a8000000606666016066160104bbbb40028888200000000000000000
|
||||||
00700700006d6500000000000cddddd00b33335009444420c00c000c0b333330b7000000a8000000e88e2882e48e24823bbaabb3288aa8820000000000000000
|
00700700006565000000000007ddddd00dd2dd200dd2dd20c00c000c0cddddd0b3000000a900000061671611616716114bb33bb4288aa8820000000000000000
|
||||||
00077000067c665000000000cdd10cd10b3dd350094dd42000c0000cb3350b35b7000000a8000000e88e2882484e24423ba77ab328a77a820000000000000000
|
00077000067f6650000000007dd207d20d2cc2200d27722000c0000ccdd20cd2b3000000a900000061671611116116114b3333b428aaaa820000000000000000
|
||||||
00077000067d665000000000cd10cdd100b3350000944200c0000000b350b335b7000000a8000000e88e2882e84e28823ba77ab328a77a820000000000000000
|
0007700006756650000000007d207dd200dd220000dd2200c0000000cd20cdd2b3000000a900000066671611666711114b3333b428aaaa820000000000000000
|
||||||
0070070065666765000000000ddddd100b33355009444220c000000c03333350b7000000a800000008888820048488203bbaabb3288aa8820000000000000000
|
0070070065666765000000000ddddd200d2d22200d2d2220c000000c0ddddd20b3000000a900000006666610061666104bb33bb4288aa8820000000000000000
|
||||||
000000006506506500000000001111000b0b5050090920200c0000c00055550037000000a2000000008882000048420003bbbb30028888200000000000000000
|
000000006506506500000000002222000d0d20200d0d20200c0000c00022220043000000a8000000006611000066110004bbbb40028888200000000000000000
|
||||||
00000000650000650000000000000000000b50000009200000c0cc00000000003b00000082000000000820000008200000333300002222000000000000000000
|
00000000650000650000000000000000000d2000000d200000c0cc00000000004b00000098000000000610000006100000444400002222000000000000000000
|
||||||
00000000000650000006500000000000b000000b80000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
00000000000650000006500000000000b000000b80000000300000000660000008800000000000000009900000000000cccccccd000650000000000000000000
|
||||||
0000000000675000000765000000000000bbbb0080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
0000000000675000000765000000000000bbbb0080000000b0000000633500008aa20000000000009009900400000000c000000d006765000000000000000000
|
||||||
00000000006d6500006d6500000000000b0000b09000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
000000000065650000656500000000000b0000b09000000040000000633500008aa20000000550009499994400000000c000000d006565000000000000000000
|
||||||
00000000067c6650067c6650000000000b0bb0b0a000000030000000033000000220000000576d009446544200000000c111111d067c66500000000000000000
|
00000000067f6650067f6650000000000b0bb0b0a000000040000000055000000220000000576d009497744400000000c000000d067f66500000000000000000
|
||||||
00000000067d6650067d6650000000000b0bb0b00000000000000000000000000000000000566d009244442200000000c111111d067d66500000000000000000
|
000000000675665006756650000000000b0bb0b00000000000000000000000000000000000566d009994444400000000c000000d067566500000000000000000
|
||||||
000000005666657576667650000000000b0000b000000000000000000000000000000000000dd0009092220200000000c111111d656667650000000000000000
|
000000005666657576667650000000000b0000b000000000000000000000000000000000000dd0009099440400000000c000000d656667650000000000000000
|
||||||
0000000056565066665656500000000000bbbb0000000000000000000000000000000000000000000090020000000000c111111d650650650000000000000000
|
0000000056565066665656500000000000bbbb0000000000000000000000000000000000000000000090040000000000c000000d650650650000000000000000
|
||||||
00000000565000566500065000000000b000000b000000000000000000000000000000000000000000a00a0000000000cddddddd650000650000000000000000
|
00000000565000566500065000000000b000000b00000000000000000000000000000000000000000090040000000000cddddddd650000650000000000000000
|
||||||
000000000000000000000000000000000000000000a0008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000000000000000000000000000000000a0008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000090008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000090008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
000000000000000000000000000000000000000000800a0000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
000000000000000000000000000000000000000000800a0000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -1971,12 +1962,12 @@ __gfx__
|
|||||||
00000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
00000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
00000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000cccccccc77000000007700000000770000000077000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000cccccccc77000000007700000000770000000077000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000c11ee11d70000000077000000007700000000770000000070000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000c007700d70000000077000000007700000000770000000070000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000c11ee11d00000000770000000077000000007700000000770000000700000000000000000000000000000000
|
0000000000000000000000000000000000000000c007800d00000000770000000077000000007700000000770000000700000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000ceeeeeed00000000700000000770000000077000000007700000007700000000000000000000000000000000
|
0000000000000000000000000000000000000000c777888d00000000700000000770000000077000000007700000007700000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000ceeeeeed00000000000000007700000000770000000077000000077000000007000000000000000000000000
|
0000000000000000000000000000000000000000c777888d00000000000000007700000000770000000077000000077000000007000000000000000000000000
|
||||||
0000000000000000000000000000000000000000c11ee11d00000000000000007000000007700000000770000000770000000077000000000000000000000000
|
0000000000000000000000000000000000000000c007800d00000000000000007000000007700000000770000000770000000077000000000000000000000000
|
||||||
0000000000000000000000000000000000000000c11ee11d00000000000000000000000077000000007700000007700000000770000000070000000000000000
|
0000000000000000000000000000000000000000c008800d00000000000000000000000077000000007700000007700000000770000000070000000000000000
|
||||||
0000000000000000000000000000000000000000cddddddd00000000000000000000000070000000077000000077000000007700000000770000000000000000
|
0000000000000000000000000000000000000000cddddddd00000000000000000000000070000000077000000077000000007700000000770000000000000000
|
||||||
cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000
|
cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000cccccccccccc0000
|
||||||
c1111111111d0000c1111111111d0000c1111111111d0000c1111111111d0000c1111111111d0000c111eeee111d0000ceee2222eeed0000c2221111222d0000
|
c1111111111d0000c1111111111d0000c1111111111d0000c1111111111d0000c1111111111d0000c111eeee111d0000ceee2222eeed0000c2221111222d0000
|
||||||
|
Loading…
Reference in New Issue
Block a user