62 lines
2.5 KiB
Text
62 lines
2.5 KiB
Text
-- Forge: the overlay bits the ActionMax port needed -- a text look's font, size, and anchors;
|
|
-- a sprite in copies; a pointer-following crosshair; discPause and discPlay; pointerX.
|
|
dofile("Forge/AuthorCompile.singe")
|
|
|
|
local font = fontLoad("Singe/FreeSansBold.ttf", 18)
|
|
|
|
fontSelect(font)
|
|
fontQuality(FONT_QUALITY_BLENDED)
|
|
|
|
dofile(authorBuild("testScripts/author/overlayBits.forge", singeGetDataPath() .. "overlayBits.singe"))
|
|
|
|
local gameUpdate = onOverlayUpdate
|
|
local frames = 0
|
|
local heldAt = nil
|
|
local heldFrames = 0
|
|
|
|
|
|
function onOverlayUpdate()
|
|
frames = frames + 1
|
|
if frames == 5 then
|
|
authorSetPointer(1, 100, 200, true)
|
|
elseif frames == 20 then
|
|
authorSetPointer(1, 600, 200, true)
|
|
elseif frames == 30 then
|
|
AUTHOR_VARS.coins = 5
|
|
authorKeyDown(0, SCANCODE.SPACE.value)
|
|
elseif (frames > 32) and (frames < 60) then
|
|
heldAt = heldAt or discGetFrame()
|
|
if discGetFrame() == heldAt then
|
|
heldFrames = heldFrames + 1
|
|
end
|
|
elseif frames == 60 then
|
|
authorKeyDown(0, SCANCODE.RETURN.value)
|
|
elseif frames == 62 then
|
|
singeScreenshot()
|
|
end
|
|
local r = gameUpdate()
|
|
|
|
if frames == 10 then
|
|
local cross = authorEntity("cross")
|
|
local cx, cy = authorPosition(cross)
|
|
|
|
if (AUTHOR_VARS.side ~= "left") or (cross.vars.text ~= nil) then debugPrint("BITS FAIL the pointer on the left was not seen: " .. tostring(AUTHOR_VARS.side)) end
|
|
if (math.abs(cx - 100) > 1) or (math.abs(cy - 200) > 1) then debugPrint(string.format("BITS FAIL the crosshair is at %.0f,%.0f, not on the pointer", cx, cy)) end
|
|
elseif frames == 25 then
|
|
if AUTHOR_VARS.side ~= "right" then debugPrint("BITS FAIL the pointer on the right was not seen") end
|
|
elseif frames == 90 then
|
|
local coins = authorEntity("coins")
|
|
local mid = authorEntity("mid")
|
|
local w, h = authorSize(authorEntity("title"))
|
|
|
|
debugPrint(string.format("BITS RESULT side=%s copies=%s held=%d frames at %s, now %d, title %dx%d, mid says %s", AUTHOR_VARS.side, tostring(coins.vars.copies), heldFrames, tostring(heldAt), discGetFrame(), w, h, mid.vars.text))
|
|
if coins.vars.copies ~= 5 then debugPrint("BITS FAIL the coins did not follow the var") end
|
|
if heldFrames < 20 then debugPrint("BITS FAIL discPause did not hold the disc") end
|
|
if discGetFrame() <= (heldAt or 0) then debugPrint("BITS FAIL discPlay did not let the disc go") end
|
|
if h < 30 then debugPrint("BITS FAIL the title's own font was not used (36 points)") end
|
|
if mid.vars.text ~= "pointer on the right" then debugPrint("BITS FAIL the centred text did not say where the pointer is") end
|
|
singeQuit()
|
|
end
|
|
|
|
return r
|
|
end
|