遊戲模式
如果你需要標題螢幕或結束遊戲螢幕,請考慮設定模式切換機制:
function _init()
mode = 1
end
function _update()
if (mode == 1) then
if (btnp(5)) mode = 2
elseif (mode == 2) then
if (btnp(5)) mode = 3
end
end
function _draw()
cls()
if (mode == 1) then
title()
elseif (mode == 2) then
print("press 'x' to win")
else
end_screen()
end
end
function title()
print("press 'x' to start game")
end
function end_screen()
print("a winner is you")
end