Compare commits
No commits in common. "d7d91dd3a71f6f67f1b254ec59b4f98f40a6e1f8" and "b4f4b8cbb53b49c973c2d6bbb10e6b24b99cc80d" have entirely different histories.
d7d91dd3a7
...
b4f4b8cbb5
@ -9,7 +9,6 @@ function board:init(w)
|
||||
self.checkpoint=nil
|
||||
self.slots={}
|
||||
self.wells={}
|
||||
self.restart_progress=0
|
||||
|
||||
-- board slots
|
||||
-- ...n_slots: normal
|
||||
@ -69,10 +68,6 @@ function board:deal(seed)
|
||||
end
|
||||
end
|
||||
|
||||
function board:set_restart_progress(progress)
|
||||
self.restart_progress=progress
|
||||
end
|
||||
|
||||
function board:undo()
|
||||
if (not self.watcher:intercept("undo")) return
|
||||
if (self.checkpoint) self.checkpoint:apply(self)
|
||||
@ -182,8 +177,6 @@ function board:draw()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
democrap:distort_screen(self.restart_progress)
|
||||
end
|
||||
|
||||
slot=klass()
|
||||
|
35
democrap.lua
35
democrap.lua
@ -1,35 +0,0 @@
|
||||
democrap={
|
||||
patterns={
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111111,
|
||||
0b1111111111111100,
|
||||
0b1111111111110000,
|
||||
0b1111110011110000,
|
||||
0b1111000011110000,
|
||||
0b1111000011000000,
|
||||
0b1111000000000000,
|
||||
0b1100000000000000,
|
||||
0b0000000000000000
|
||||
}
|
||||
}
|
||||
function democrap:distort_screen(progress)
|
||||
if (progress <= 0) return
|
||||
progress=min(progress,1)
|
||||
for src=0x6002,0x7fc2,64 do
|
||||
dst=src+sin(t()+src/0x800)*(4*progress)+0.5
|
||||
memcpy(dst,src,60)
|
||||
end
|
||||
local ps=democrap.patterns
|
||||
local p=ps[1+flr(progress*#ps)] or ps[#ps]
|
||||
fillp(p)
|
||||
local old=@0x5333
|
||||
poke(0x5f33,1)
|
||||
rectfill(0,0,127,127,13)
|
||||
poke(0x5f33,old)
|
||||
fillp()
|
||||
end
|
@ -2,6 +2,7 @@
|
||||
modules={}
|
||||
|
||||
function _init()
|
||||
-- printh("restarting")
|
||||
_doall("init")
|
||||
end
|
||||
|
||||
|
1
main.lua
1
main.lua
@ -13,5 +13,4 @@ end
|
||||
|
||||
function main:draw()
|
||||
self.state_manager:draw()
|
||||
apply_palette()
|
||||
end
|
||||
|
4
main.p8
4
main.p8
@ -2,25 +2,21 @@ pico-8 cartridge // http://www.pico-8.com
|
||||
version 41
|
||||
__lua__
|
||||
#include engine.lua
|
||||
#include palette.lua
|
||||
#include animator.lua
|
||||
#include board.lua
|
||||
#include board_animations.lua
|
||||
#include checkpoint.lua
|
||||
#include dealer.lua
|
||||
#include democrap.lua
|
||||
#include cursor.lua
|
||||
#include layout.lua
|
||||
#include layout_hint.lua
|
||||
#include ruleset.lua
|
||||
#include palette.lua
|
||||
#include progression.lua
|
||||
#include seed_constants.lua
|
||||
#include seeds.lua
|
||||
#include state_manager.lua
|
||||
#include state_gameround.lua
|
||||
#include state_ironman.lua
|
||||
#include state_restartmenu.lua
|
||||
#include tutorial.lua
|
||||
#include text.lua
|
||||
#include watcher.lua
|
||||
|
17
palette.lua
17
palette.lua
@ -1,17 +0,0 @@
|
||||
function apply_palette()
|
||||
-- bg
|
||||
pal(13,-3,1)
|
||||
|
||||
-- arcana
|
||||
-- pal(1,0,1)
|
||||
pal(15,-9,1)
|
||||
|
||||
-- suits
|
||||
pal(4,-11,1) -- first suit
|
||||
pal(12,12,1)
|
||||
pal(2,-8,1)
|
||||
pal(3,-5,1)
|
||||
|
||||
-- pal(8,-9,1)
|
||||
-- pal(14,8,1)
|
||||
end
|
@ -1,8 +1,6 @@
|
||||
state_gameround=klass()
|
||||
function state_gameround:init(watcher,ruleset)
|
||||
self.board=board:new(watcher,ruleset)
|
||||
self.outcome=nil
|
||||
self.restart_frames=0
|
||||
end
|
||||
function state_gameround:enter() end
|
||||
function state_gameround:exit() end
|
||||
@ -12,19 +10,6 @@ function state_gameround:suspend() end
|
||||
|
||||
function state_gameround:update()
|
||||
self.board:update()
|
||||
if btn(5) then
|
||||
self.restart_frames+=1
|
||||
else
|
||||
self.restart_frames=0
|
||||
end
|
||||
local restart_progress=self.restart_frames/60
|
||||
self.board:set_restart_progress(restart_progress)
|
||||
|
||||
if restart_progress>=1.0 then
|
||||
main.state_manager:push(state_restartmenu:new())
|
||||
return
|
||||
end
|
||||
|
||||
if self.board:can_take_input() then
|
||||
if (btnp(0)) self.board.cursor:move_x(-1)
|
||||
if (btnp(1)) self.board.cursor:move_x(1)
|
||||
@ -33,10 +18,25 @@ function state_gameround:update()
|
||||
if (btnp(4)) self.board.cursor:toggle_grab()
|
||||
if (btnp(5)) self.board:undo()
|
||||
end
|
||||
if (self.board:is_won()) self.outcome="win" self.done=true
|
||||
if (self.board:is_won()) self.done=true
|
||||
end
|
||||
|
||||
function state_gameround:draw()
|
||||
cls(13)
|
||||
self.board:draw()
|
||||
-- bg
|
||||
pal(13,-3,1)
|
||||
|
||||
-- arcana
|
||||
-- pal(1,0,1)
|
||||
pal(15,-9,1)
|
||||
|
||||
-- suits
|
||||
pal(4,-11,1) -- first suit
|
||||
pal(12,12,1)
|
||||
pal(2,-8,1)
|
||||
pal(3,-5,1)
|
||||
|
||||
-- pal(8,-9,1)
|
||||
-- pal(14,8,1)
|
||||
end
|
@ -7,29 +7,16 @@ end
|
||||
function state_ironman:enter() self:on_enter() end
|
||||
function state_ironman:exit() end
|
||||
|
||||
function state_ironman:reenter(round)
|
||||
printh("reenter "..round.outcome)
|
||||
if round.outcome=="win" then
|
||||
self.level+=1
|
||||
elseif round.outcome=="menu" then
|
||||
self.done=true
|
||||
elseif round.outcome=="restart" then
|
||||
else
|
||||
assert(false,"unrecognized outcome: "..round.outcome)
|
||||
end
|
||||
|
||||
self:on_enter()
|
||||
end
|
||||
function state_ironman:reenter() self:on_enter() end
|
||||
function state_ironman:suspend() end
|
||||
|
||||
function state_ironman:on_enter()
|
||||
self.done=true
|
||||
local level=self.level
|
||||
if (self.done) return
|
||||
self.level+=1
|
||||
if level <= #self.sequence then
|
||||
local w=self.sequence[level]()
|
||||
main.state_manager:push(state_gameround:new(w))
|
||||
else
|
||||
self.done=true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
state_restartmenu=klass()
|
||||
function state_restartmenu:init()
|
||||
end
|
||||
function state_restartmenu:enter() end
|
||||
function state_restartmenu:exit(new_top)
|
||||
new_top.outcome=self.outcome
|
||||
new_top.done=true
|
||||
end
|
||||
|
||||
function state_restartmenu:reenter() end
|
||||
function state_restartmenu:suspend() end
|
||||
|
||||
function state_restartmenu:update()
|
||||
if (btnp(0)) self.outcome="menu" self.done=true
|
||||
if (btnp(4)) self.outcome="restart" self.done=true
|
||||
end
|
||||
function state_restartmenu:draw()
|
||||
cls(13)
|
||||
print("⬅️ back to menu",1,58,7)
|
||||
print("🅾️ restart",1,64,7)
|
||||
end
|
@ -1,5 +1,4 @@
|
||||
tutorial={
|
||||
-- function() return watcher:new(progression[6]) end,
|
||||
function()
|
||||
return watcher:new(progression[1], 10,{
|
||||
tutorial_grab:new(1,4),
|
||||
|
Loading…
Reference in New Issue
Block a user