it compiles! it's fucked up but it compiles

sign errors and math errors abound
This commit is contained in:
Kistaro Windrider 2024-02-03 21:10:03 -08:00
parent 525c7e0cb6
commit 16469f0863
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -559,11 +559,11 @@ toyphin = {
}
mknew(toyphin)
function dive_bloop()
function dive_splash(x)
-- TODO: sfx, vfx for dive input
end
function jump_bloop()
function jump_splash(x)
-- TODO: sfx, vfx for jump input
end
@ -576,42 +576,42 @@ function landing_splash(x, force, harder)
end
function toyphin:update()
local x, y, dy = self.x, self.y, self.dy
-- entry mode?
if not self.entered then
self.x += 1
self.entered = self.x >= 16
x += 1
self.entered = x >= 16
elseif self.exiting then
if self.x > 128 then
if x > 128 then
self.exited = true
else
self.x += 1
x += 1
end
end
local y, dy = self.y, self.dy
-- button handling
if self.entered and not self.exiting then
if self.state.idle then
if (btnp(0)) then
jump_bloop()
if (btn(2)) then
jump_splash(x)
dy=-4.125
elseif (btnp(1)) then
dive_bloop()
elseif (btn(3)) then
dive_splash(x)
dy=4.125
end
else
dy += (btnp(1) and 0.1875 or 0) - (btnp(0) and 0.1875 or 0)
dy += (btn(3) and 0.1875 or 0) - (btn(2) and 0.1875 or 0)
end
end
if (y > 64) dy += 0.375
if (y < 64) dy -= 0.375
if (y > 64) dy -= 0.375
if (y < 64) dy += 0.375
local new_y = y + dy
if new_y <= 64 && y > 64 then
if new_y <= 64 and y > 64 then
-- surfacing
surfacing_splash(self.x, -dy, btn(0) and (dy > -4.125))
if btn(0) then
surfacing_splash(x, -dy, btn(2) and (dy > -4.125))
if btn(2) then
-- maybe boost
if dy > -4.125 then
new_y = 64 + ((dy + y - 64)/dy * -4.125)
@ -619,18 +619,19 @@ function toyphin:update()
end
else
-- brake
if dy > -0.5 then
if dy > -1 then
--stabilize
new_y = 64
dy = 0
else
dy /= 4
new_y = 48 + new_y/4
dy /= 2
new_y = 32 + new_y/2
end
end
elseif new_y >= 64 && y < 64 then
elseif new_y >= 64 and y < 64 then
-- landing
landing_splash(self.x, dy, btn(1) and (dy < 4.125))
if btn(1) then
landing_splash(x, dy, btn(3) and (dy < 4.125))
if btn(3) then
-- maybe boost
if dy < 4.125 then
new_y = 64 - ((dy - y + 64)/dy * 4.125)
@ -638,13 +639,14 @@ function toyphin:update()
end
else
--brake
if dy < 0.5 then
if dy < 1 then
--stabilize
new_y = 64
dy = 0
else
dy /= 4
new_y = 80 - new_y/4
dy /= 2
new_y = 96 - new_y/2
end
end
end
y=new_y
@ -666,7 +668,7 @@ function toyphin:update()
if (y == 64 and dy == 0) st = phinstate_nrm
-- test mode
--if (btn(5)) self.exiting = true
self.y, self.dy, self.state = y, dy, st
self.x, self.y, self.dy, self.state = x, y, dy, st
end
-- hitbox for current state