Compare commits
10 Commits
gun_picker
...
main
Author | SHA1 | Date | |
---|---|---|---|
aea2a8c481 | |||
9b24f10c23 | |||
511c18f90e | |||
142810ee2d | |||
50beae1852 | |||
9c95fc1784 | |||
cb2d24c9d0 | |||
67603f8496 | |||
2cebea663f | |||
eed7b6af87 |
197
vacuum_gambit.p8
197
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()
|
||||
@ -502,14 +503,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 +612,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,8)
|
||||
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, 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
|
||||
@ -689,6 +685,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 +694,19 @@ 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
|
||||
|
||||
function bullet_base:hitship(_)
|
||||
self:die()
|
||||
return true
|
||||
@ -720,14 +730,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 +782,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,7 +846,7 @@ 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
|
||||
cuts through
|
||||
@ -1019,6 +1022,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 +1035,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 +1065,86 @@ 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=[[ armor
|
||||
|
||||
+2 hp]],
|
||||
action=function()
|
||||
self.maxhp += 2
|
||||
self.hp += 2
|
||||
end,
|
||||
},{
|
||||
icon=52,
|
||||
hdr="shield",
|
||||
body=[[ capacity
|
||||
|
||||
+1 hp]],
|
||||
action=function()
|
||||
self.maxshield += 1
|
||||
self.shield += 1
|
||||
end,
|
||||
},{
|
||||
icon=1,
|
||||
hdr="thrusters",
|
||||
body=[[performance
|
||||
|
||||
move faster,
|
||||
steer faster]],
|
||||
action=function()
|
||||
--maxspd thrust drag
|
||||
self.maxspd += 0.5
|
||||
self.thrust += 0.0625
|
||||
self.drag += 0.03125
|
||||
end,
|
||||
},{
|
||||
icon=20,
|
||||
hdr="hull",
|
||||
body=[[ magnet
|
||||
|
||||
pick up xp
|
||||
from further
|
||||
away]],
|
||||
action=function ()
|
||||
self.magnet += 2
|
||||
end,
|
||||
}}
|
||||
|
||||
if cdr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "shield",
|
||||
body=[[charge rate
|
||||
|
||||
]] .. tostr(ceil(100 * cdr / self.shieldcooldown)) .. "% faster",
|
||||
action = function()
|
||||
self.shieldcooldown -= cdr
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
if pr > 0 then
|
||||
add(ret, {
|
||||
icon = 6,
|
||||
hdr = "shield",
|
||||
body=[[disruption
|
||||
|
||||
]] .. 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
|
||||
@ -1536,10 +1620,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 +1706,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 +1793,8 @@ 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
|
||||
return pick(primary_ship:small_upgrade_opts(), 2)
|
||||
end
|
||||
|
||||
-->8
|
||||
@ -1783,7 +1868,7 @@ function rearm_mode:shuffle()
|
||||
-- these will be placeholders
|
||||
-- until the upgrade deck
|
||||
-- is a thing that exists
|
||||
local lev = primary_ship.level + 1
|
||||
local lev = primary_ship.level
|
||||
if lev == 4 or lev == 12 then
|
||||
self.options = spec_gun_opts()
|
||||
elseif lev % 4 == 0 then
|
||||
@ -1877,14 +1962,14 @@ __gfx__
|
||||
0070070065666765000000000ddddd100b33355009444220c000000c03333350b7000000a800000008888820048488203bbaabb3288aa8820000000000000000
|
||||
000000006506506500000000001111000b0b5050090920200c0000c00055550037000000a2000000008882000048420003bbbb30028888200000000000000000
|
||||
00000000650000650000000000000000000b50000009200000c0cc00000000003b00000082000000000820000008200000333300002222000000000000000000
|
||||
00000000000650000006500000000000b000000b80000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
||||
0000000000675000000765000000000000bbbb0080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
||||
00000000006d6500006d6500000000000b0000b09000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
||||
00000000067c6650067c6650000000000b0bb0b0a000000030000000033000000220000000576d009446544200000000c111111d067c66500000000000000000
|
||||
00000000067d6650067d6650000000000b0bb0b00000000000000000000000000000000000566d009244442200000000c111111d067d66500000000000000000
|
||||
000000005666657576667650000000000b0000b000000000000000000000000000000000000dd0009092220200000000c111111d656667650000000000000000
|
||||
0000000056565066665656500000000000bbbb0000000000000000000000000000000000000000000090020000000000c111111d650650650000000000000000
|
||||
00000000565000566500065000000000b000000b000000000000000000000000000000000000000000a00a0000000000cddddddd650000650000000000000000
|
||||
0000000000065000000650000003b0000070070080000000700000000bb0000008800000000000000009200000000000cccccccd000650000000000000000000
|
||||
000000000067500000076500000370000005500080000000b0000000b76300008a920000000000009009200200000000c111111d006765000000000000000000
|
||||
00000000006d6500006d6500000b7000700660079000000030000000b663000089920000000550009994444200000000c111111d006d65000000000000000000
|
||||
00000000067c6650067c6650000b7000056ccd50a000000030000000033000000220000000576d009446544200000000c111111d067c66500000000000000000
|
||||
00000000067d6650067d6650000b7000056ccd500000000000000000000000000000000000566d009244442200000000c111111d067d66500000000000000000
|
||||
000000005666657576667650000b7000700dd00700000000000000000000000000000000000dd0009092220200000000c111111d656667650000000000000000
|
||||
000000005656506666565650000370000005500000000000000000000000000000000000000000000090020000000000c111111d650650650000000000000000
|
||||
0000000056500056650006500003b00000700700000000000000000000000000000000000000000000a00a0000000000cddddddd650000650000000000000000
|
||||
060007000600070006600770766c777c0000000000a0008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
6cd07cd06cd07cd06ccd7ccd6ccd7ccd000000000090008000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0d000d006cd07cd06ccd7ccd6ccd7ccd0000000000800a0000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
Loading…
x
Reference in New Issue
Block a user