surive at 0hp and adjust hp values to match
Instead of doing a special case for 1HP, 0HP is survivable, ships die at negative HP instead. all ship health is adjusted to match, assuming the weakest shot is 0.5hp, which is currently true. the "real" game will totally rebalance all ships and weapons anyway. we're getting close to when I have to stop dawdling and implement the real game, the engine is _there._
This commit is contained in:
parent
6b8efe3438
commit
cc1e7ea5b7
@ -339,15 +339,15 @@ function drawhud()
|
|||||||
inset(120,66,125,125)
|
inset(120,66,125,125)
|
||||||
-- 57 px vertically
|
-- 57 px vertically
|
||||||
local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp
|
local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp
|
||||||
if (mxs > 0) and (mxh > 1) then
|
if (mxs > 0) and (mxh > 0) then
|
||||||
local split = 57 * (mxs / (mxs + mxh-1)) \ 1 + 66
|
local split = 57 * (mxs / (mxs + mxh)) \ 1 + 66
|
||||||
line(121, split, 124, split, 0xba)
|
line(121, split, 124, split, 0xba)
|
||||||
vertmeter(121,67,124,split-1,cs, mxs,shlcols)
|
vertmeter(121,67,124,split-1,cs, mxs,shlcols)
|
||||||
vertmeter(121,split+1,124,124,ch-1, mxh-1, hpcols)
|
vertmeter(121,split+1,124,124,ch, mxh, hpcols)
|
||||||
elseif mxs > 0 then
|
elseif mxs > 0 then
|
||||||
vertmeter(121,67,124,124,cs,mxs,shlcols)
|
vertmeter(121,67,124,124,cs,mxs,shlcols)
|
||||||
elseif mxh > 1 then
|
elseif mxh > 0 then
|
||||||
vertmeter(121,67,124,124,ch-1,mxh-1,hpcols)
|
vertmeter(121,67,124,124,ch,mxh,hpcols)
|
||||||
else
|
else
|
||||||
print("!", 122, 94, 9)
|
print("!", 122, 94, 9)
|
||||||
print("!", 121, 93, 8)
|
print("!", 121, 93, 8)
|
||||||
@ -441,7 +441,7 @@ mknew(ship_m)
|
|||||||
|
|
||||||
function ship_m:die()
|
function ship_m:die()
|
||||||
self.dead = true
|
self.dead = true
|
||||||
if (self.hp <= 0) boom(self.x+self.size*4, self.y+self.size*4,12*self.size, self.boss)
|
if (self.hp < 0) boom(self.x+self.size*4, self.y+self.size*4,12*self.size, self.boss)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ship_m:calc_velocity(v0, t)
|
function ship_m:calc_velocity(v0, t)
|
||||||
@ -551,7 +551,7 @@ function ship_m:hitsomething(dmg)
|
|||||||
dmg -= self.shield
|
dmg -= self.shield
|
||||||
self.shield = 0
|
self.shield = 0
|
||||||
self.hp -= dmg
|
self.hp -= dmg
|
||||||
if self.hp <= 0 then
|
if self.hp < 0 then
|
||||||
self:die()
|
self:die()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -916,11 +916,10 @@ player = ship_m.new{
|
|||||||
mknew(player,
|
mknew(player,
|
||||||
function(p)
|
function(p)
|
||||||
p.main_gun = zap_gun.new()
|
p.main_gun = zap_gun.new()
|
||||||
-- ONE HIT MODE: max hp is
|
-- ONE HIT MODE
|
||||||
-- minimum nonzero value.
|
|
||||||
--
|
--
|
||||||
-- p.hp = 0x0.0001
|
-- p.hp = 0
|
||||||
-- p.maxhp = 0x0.0001
|
-- p.maxhp = 0
|
||||||
-- p.shield = 0
|
-- p.shield = 0
|
||||||
-- p.maxshield = 0
|
-- p.maxshield = 0
|
||||||
end
|
end
|
||||||
@ -940,7 +939,7 @@ frownie = ship_m.new{
|
|||||||
sparkodds = 8,
|
sparkodds = 8,
|
||||||
|
|
||||||
-- health and power
|
-- health and power
|
||||||
hp = 1, -- enemy ships need no max hp
|
hp = 0.5, -- enemy ships need no max hp
|
||||||
|
|
||||||
-- position
|
-- position
|
||||||
x=60, -- x and y are for upper left corner
|
x=60, -- x and y are for upper left corner
|
||||||
@ -962,7 +961,7 @@ mknew(frownie)
|
|||||||
|
|
||||||
blocky = frownie.new{
|
blocky = frownie.new{
|
||||||
sprite = 10,
|
sprite = 10,
|
||||||
hp = 2,
|
hp = 1.5,
|
||||||
hurt = {
|
hurt = {
|
||||||
x_off = 0,
|
x_off = 0,
|
||||||
y_off = 0,
|
y_off = 0,
|
||||||
@ -971,7 +970,7 @@ blocky = frownie.new{
|
|||||||
},
|
},
|
||||||
|
|
||||||
ow = function(self)
|
ow = function(self)
|
||||||
if self.hp <= 1 then
|
if self.hp < 1 then
|
||||||
self.sprite = 11
|
self.sprite = 11
|
||||||
else
|
else
|
||||||
self.sprite = 10
|
self.sprite = 10
|
||||||
@ -990,7 +989,7 @@ spewy = frownie.new{
|
|||||||
width=8,
|
width=8,
|
||||||
height=5
|
height=5
|
||||||
},
|
},
|
||||||
hp=1,
|
hp=0.5,
|
||||||
maxpower=70,
|
maxpower=70,
|
||||||
generator=0.5,
|
generator=0.5,
|
||||||
fire_off_x=4,
|
fire_off_x=4,
|
||||||
@ -1015,7 +1014,7 @@ chasey = ship_m.new{
|
|||||||
},
|
},
|
||||||
sparks = smokespark,
|
sparks = smokespark,
|
||||||
sparkodds = 8,
|
sparkodds = 8,
|
||||||
hp = 2,
|
hp = 1.5,
|
||||||
shield = 1,
|
shield = 1,
|
||||||
maxshield = 1,
|
maxshield = 1,
|
||||||
shieldcost = 180,
|
shieldcost = 180,
|
||||||
@ -1047,7 +1046,7 @@ xl_chasey=chasey.new{
|
|||||||
width = 12,
|
width = 12,
|
||||||
height = 10
|
height = 10
|
||||||
},
|
},
|
||||||
hp = 20,
|
hp = 19.5,
|
||||||
shield = 5,
|
shield = 5,
|
||||||
boss = true,
|
boss = true,
|
||||||
slip = false,
|
slip = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user