Compare commits

...

2 Commits

Author SHA1 Message Date
33fede4ed8
update comment about off-by-1 error 2024-12-29 23:41:47 -08:00
afa1f22170
go back to 0x0.0001 increments for xp
I foresee the 32K limit being a bigger problem than the math in vertmeter, although I will probably need to go patch vertmeter up too
2024-12-29 23:39:56 -08:00

View File

@ -378,8 +378,10 @@ function drawhud()
else
vertmeter(115,58,118,117,primary_ship.xp, primary_ship.xptarget, powcols)
end
-- 59 px vertically? or 60? off-by-1 error somewhere here or in vertmeter?
-- it's here. I think
-- 60 px vertically. note that
-- there was at one point an
-- off-by-one and I'm not sure
-- it's actually fixed
local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp
if (mxs > 0) and (mxh > 0) then
local split = 59 * (mxs / (mxs + mxh)) \ 1 + 64
@ -485,14 +487,15 @@ function ship_m:die()
local sz4 = self.size * 4
local cx, cy, xp, z = self.x + sz4, self.y + sz4, self.xp or 0, 0
boom(cx, cy, 3*sz4, self.boss)
if xp > 499 then
if xp > 0x0.01f3 then -- dec 499
-- spawn a huge gem with all
-- overage XP, min 100
spawn_xp_at(cx, cy, 0, xp-399)
xp = 399
spawn_xp_at(cx, cy, 0, xp-0x0.18f)
xp = 0x0.18f -- dec 399
z += 1
end
for gsz in all{100, 25, 5, 1} do
-- 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
@ -950,9 +953,9 @@ player = mknew(ship_m.new{
shield = 2, -- regenerates
maxshield = 2,
-- xp; watch out for 16-bit range limits
-- xp in increments of 0x0.0001
xp = 0,
xptarget = 4,
xptarget = 0x0.0004,
level = 1,
-- gun
@ -1010,7 +1013,7 @@ frownie = mknew(ship_m.new{
sparkodds = 8,
hp = 0.5, -- enemy ships need no max hp
xp = 1,
xp = 0x0.0001,
-- position
x=60, -- x and y are for upper left corner
@ -1032,7 +1035,7 @@ frownie = mknew(ship_m.new{
blocky = mknew(frownie.new{
sprite = 10,
hp = 1.5,
xp = 2,
xp = 0x0.0002,
hurt = {
x_off = 0,
y_off = 0,
@ -1052,7 +1055,7 @@ blocky = mknew(frownie.new{
spewy = mknew(frownie.new{
sprite=26,
xp = 3,
xp = 0x0.0003,
hurt = {
x_off=0,
y_off=1,
@ -1073,7 +1076,7 @@ spewy = mknew(frownie.new{
chasey = mknew(ship_m.new{
sprite = 5,
xp = 4,
xp = 0x0.0004,
size = 1,
hurt = {
x_off = 1,
@ -1108,7 +1111,7 @@ end
xl_chasey=mknew(chasey.new{
size=2,
xp = 10,
xp = 0x0.000a,
maxspd=1.25,
hurt = {
x_off = 2,
@ -1606,7 +1609,7 @@ function spawn_xp_at(x, y, off, amt)
x += rnd(off+off)-off
y += rnd(off+off)-off
xp_gem.new{
qsprite=amt == 1 and 32 or amt == 5 and 33 or amt == 25 and 34 or 35,
qsprite=amt == 0x0.0001 and 32 or amt == 0x0.0005 and 33 or amt == 0x0.0019 and 34 or 35,
val = amt,
}:spawn_at(mid(x, 0, 124),mid(y,-4,125))
end