forked from pyrex/chameleonic
Compare commits
No commits in common. "0aeeb1975b5f3c030444b5e5073e21359dee2ec0" and "7c209f11252314ae3fbd426adb19616706141d34" have entirely different histories.
0aeeb1975b
...
7c209f1125
157
chameleonic.p8
157
chameleonic.p8
@ -8,9 +8,8 @@ real_modules={}
|
|||||||
frame=0
|
frame=0
|
||||||
function _init()
|
function _init()
|
||||||
-- printh("restarting")
|
-- printh("restarting")
|
||||||
_doall("init")
|
music_on()
|
||||||
end
|
_doall("init") end
|
||||||
|
|
||||||
function _update()
|
function _update()
|
||||||
frame+=1
|
frame+=1
|
||||||
if (frame%1==0) _doall("update") end
|
if (frame%1==0) _doall("update") end
|
||||||
@ -18,16 +17,12 @@ function _draw()
|
|||||||
_doall("draw") end
|
_doall("draw") end
|
||||||
|
|
||||||
function music_on()
|
function music_on()
|
||||||
if (stat(54) ~= 0) music(0)
|
music(0)
|
||||||
persist.music=true
|
|
||||||
persist:write()
|
|
||||||
menuitem(3, "music: on", music_off)
|
menuitem(3, "music: on", music_off)
|
||||||
end
|
end
|
||||||
|
|
||||||
function music_off()
|
function music_off()
|
||||||
music(-1)
|
music(-1)
|
||||||
persist.music=false
|
|
||||||
persist:write()
|
|
||||||
menuitem(3, "music: off", music_on)
|
menuitem(3, "music: off", music_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -266,7 +261,7 @@ end
|
|||||||
title={}
|
title={}
|
||||||
add(modules,title)
|
add(modules,title)
|
||||||
|
|
||||||
lvlshimmer = {4,9,10,10,9}
|
blinkcol=10
|
||||||
function title:draw()
|
function title:draw()
|
||||||
cls(0)
|
cls(0)
|
||||||
-- this is right for 72x32
|
-- this is right for 72x32
|
||||||
@ -275,33 +270,22 @@ function title:draw()
|
|||||||
print("[nyeogmi]",62,73,7)
|
print("[nyeogmi]",62,73,7)
|
||||||
print("kistaro",32,79,7)
|
print("kistaro",32,79,7)
|
||||||
local lvlstr = "⬅️ "..start_level.." ➡️"
|
local lvlstr = "⬅️ "..start_level.." ➡️"
|
||||||
local lx, ly = 51+wrongbleep:vibrate(), 90+wrongbleep:vibrate()
|
print(lvlstr,50,91,1)
|
||||||
print(lvlstr,lx-1,ly+1,1)
|
print(lvlstr,51,90,blinkcol)
|
||||||
print(lvlstr,lx,ly,cycle(lvlshimmer))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function title:init()
|
start_level=0
|
||||||
start_level=persist.recent_level
|
max_level=31
|
||||||
-- max_level=persist.max_level
|
|
||||||
max_level = 31 --debugging/coding
|
|
||||||
wiped = false
|
|
||||||
end
|
|
||||||
|
|
||||||
function title:update()
|
function title:update()
|
||||||
|
blinkcol=9
|
||||||
|
if (time()*4\1%2==0) blinkcol=10
|
||||||
|
|
||||||
if (btnp"0") start_level-=1
|
if (btnp"0") start_level-=1
|
||||||
if (btnp"1") start_level+=1
|
if (btnp"1") start_level+=1
|
||||||
start_level%=(max_level+1)
|
start_level%=max_level
|
||||||
if btn"3" and not wiped then
|
|
||||||
wrongbleep:bleep()
|
if (btnp"4" or btnp"5") modules=real_modules _init() music(0)
|
||||||
if (wrongbleep:adequately_warned()) then
|
|
||||||
persist:wipe()
|
|
||||||
max_level = 0
|
|
||||||
start_level = 0
|
|
||||||
wiped=true
|
|
||||||
-- todo: sfx(kaboom!)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (btnp"4" or btnp"5") modules=real_modules _init()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
@ -324,8 +308,6 @@ function level:reinit(n)
|
|||||||
self:load_dynobjs()
|
self:load_dynobjs()
|
||||||
self:recollide_reanchor()
|
self:recollide_reanchor()
|
||||||
self:spawn_exit()
|
self:spawn_exit()
|
||||||
|
|
||||||
persist:lvlstart()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function level:restart()
|
function level:restart()
|
||||||
@ -994,7 +976,7 @@ function rope:affected_src_xy(artificial_px,artificial_py)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function rope:draw(artificial_px,artificial_py)
|
function rope:draw(artificial_px,artificial_py)
|
||||||
local points,highlight,hypo_ops,hypo_blocks=self:_tug(true)
|
local points,highlight,hypo_ops=self:_tug(true)
|
||||||
local n,perc_to_show,from_end = self.state.name,1.0
|
local n,perc_to_show,from_end = self.state.name,1.0
|
||||||
if (n=="done") return
|
if (n=="done") return
|
||||||
if (n=="cast") perc_to_show=self.state.frame/2
|
if (n=="cast") perc_to_show=self.state.frame/2
|
||||||
@ -1066,17 +1048,11 @@ function rope:draw(artificial_px,artificial_py)
|
|||||||
|
|
||||||
-- hypothetical
|
-- hypothetical
|
||||||
local time=t()-self.flicker_t
|
local time=t()-self.flicker_t
|
||||||
if n=="latched" and time>0 and not level:busy() then
|
if n=="latched" and time>0 and time%0.5>0.25 and not level:busy() then
|
||||||
if time%0.5>0.25 then
|
for o in all(hypo_ops) do
|
||||||
for o in all(hypo_ops) do
|
local mx0,my0,dmx,dmy=unpack(o)
|
||||||
local mx0,my0,dmx,dmy=unpack(o)
|
local px1,py1=(mx0+dmx)*8,(my0+dmy)*8
|
||||||
local px1,py1=(mx0+dmx)*8,(my0+dmy)*8
|
spr(14,px1,py1)
|
||||||
spr(14,px1,py1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for o in all(hypo_blocks) do
|
|
||||||
local x,y,dx,dy=unpack(o)
|
|
||||||
spr(53,8*x+4*dx,8*y+4*dy,1,1,time%0.5>0.25)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1537,23 +1513,20 @@ function rope:_tug(hypothetically)
|
|||||||
local ancs=self:_anchors_simplified()
|
local ancs=self:_anchors_simplified()
|
||||||
local touched={}
|
local touched={}
|
||||||
|
|
||||||
local blocks = {}
|
|
||||||
for i=#ancs-1,2,-1 do
|
for i=#ancs-1,2,-1 do
|
||||||
local ops_before_trash,blocks_before_trash=self:_calc_push(ancs[i+1],ancs[i],ancs[i-1],ancs[i-2])
|
local ops_before_trash=self:_calc_push(ancs[i+1],ancs[i],ancs[i-1],ancs[i-2])
|
||||||
local ops_to_do,corners={}
|
local ops_to_do,corners={}
|
||||||
for b in all(blocks_before_trash) do add(blocks, b) end
|
|
||||||
if #ops_before_trash>0 then
|
if #ops_before_trash>0 then
|
||||||
ops_to_do=ops_before_trash
|
ops_to_do=ops_before_trash
|
||||||
else
|
else
|
||||||
local ops_after_trash,blocks_after_trash=self:_calc_push(ancs[i-2],ancs[i-1],ancs[i],ancs[i+1])
|
local ops_after_trash=self:_calc_push(ancs[i-2],ancs[i-1],ancs[i],ancs[i+1])
|
||||||
ops_to_do=ops_after_trash
|
ops_to_do=ops_after_trash
|
||||||
for b in all(blocks_after_trash) do add(blocks,b) end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local ops=ops_to_do
|
local ops=ops_to_do
|
||||||
|
|
||||||
if #ops>0 then
|
if #ops>0 then
|
||||||
if (hypothetically) return ancs,i-1,ops,blocks
|
if (hypothetically) return ancs,i-1,ops
|
||||||
|
|
||||||
for o in all(ops) do level:tug_crate(unpack(o)) end
|
for o in all(ops) do level:tug_crate(unpack(o)) end
|
||||||
return true
|
return true
|
||||||
@ -1562,7 +1535,7 @@ function rope:_tug(hypothetically)
|
|||||||
|
|
||||||
local latch=self.latch
|
local latch=self.latch
|
||||||
if latch and latch.el=="eyehook" then
|
if latch and latch.el=="eyehook" then
|
||||||
if (hypothetically) return ancs,0,{},blocks
|
if (hypothetically) return ancs,0,{}
|
||||||
player.todo={{
|
player.todo={{
|
||||||
update=function(s)
|
update=function(s)
|
||||||
if not s.rope or s.rope:done() then
|
if not s.rope or s.rope:done() then
|
||||||
@ -1603,19 +1576,17 @@ function rope:_tug(hypothetically)
|
|||||||
invalid_move=true
|
invalid_move=true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not invalid_move then
|
if not invalid_move and
|
||||||
if level:can_move(false,mx0,my0,dmx,dmy,1,0) then
|
level:can_move(false,mx0,my0,dmx,dmy,1,0)
|
||||||
if (hypothetically) return ancs,0,{{mx0,my0,dmx,dmy}},blocks
|
then
|
||||||
|
if (hypothetically) return ancs,0,{{mx0,my0,dmx,dmy}}
|
||||||
|
|
||||||
level:tug_crate(mx0,my0,dmx,dmy)
|
level:tug_crate(mx0,my0,dmx,dmy)
|
||||||
return true
|
return true
|
||||||
else
|
|
||||||
add(blocks, {mx0,my0,dmx,dmy})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (hypothetically) return ancs,0,{},blocks
|
if (hypothetically) return ancs
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1685,7 +1656,7 @@ function rope:_calc_push(
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ops2,blocked={},{}
|
local ops2={}
|
||||||
for o in all(ops) do
|
for o in all(ops) do
|
||||||
local mx,my,dmx,dmy=unpack(o)
|
local mx,my,dmx,dmy=unpack(o)
|
||||||
if not level:mcoll(mx,my) then
|
if not level:mcoll(mx,my) then
|
||||||
@ -1694,7 +1665,6 @@ function rope:_calc_push(
|
|||||||
local crate=level:get_crate(mx,my)
|
local crate=level:get_crate(mx,my)
|
||||||
if crate then
|
if crate then
|
||||||
if not level:can_move(false,mx,my,dmx,dmy,0,0) then
|
if not level:can_move(false,mx,my,dmx,dmy,0,0) then
|
||||||
add(blocked,o)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -1703,7 +1673,7 @@ function rope:_calc_push(
|
|||||||
add(ops2,o)
|
add(ops2,o)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ops2,blocked
|
return ops2
|
||||||
end
|
end
|
||||||
|
|
||||||
function rope:_anchors_simplified()
|
function rope:_anchors_simplified()
|
||||||
@ -1745,7 +1715,6 @@ end
|
|||||||
-->8
|
-->8
|
||||||
--wrongbleeps
|
--wrongbleeps
|
||||||
wrongbleep={}
|
wrongbleep={}
|
||||||
add(modules,wrongbleep)
|
|
||||||
add(real_modules,wrongbleep)
|
add(real_modules,wrongbleep)
|
||||||
function wrongbleep:init()
|
function wrongbleep:init()
|
||||||
self.duration=0
|
self.duration=0
|
||||||
@ -1753,12 +1722,8 @@ function wrongbleep:init()
|
|||||||
end
|
end
|
||||||
function wrongbleep:update()
|
function wrongbleep:update()
|
||||||
if (self.duration>5) self.duration=5
|
if (self.duration>5) self.duration=5
|
||||||
if self.duration>0 then
|
if self.duration>0 then sfx(63,3) self.continuous+=1
|
||||||
sfx(63,3)
|
else self.continuous=0 end
|
||||||
self.continuous+=1
|
|
||||||
else
|
|
||||||
self.continuous=0
|
|
||||||
end
|
|
||||||
self.duration=max(self.duration-1,-4)
|
self.duration=max(self.duration-1,-4)
|
||||||
end
|
end
|
||||||
function wrongbleep:bleep(duration)
|
function wrongbleep:bleep(duration)
|
||||||
@ -1916,48 +1881,6 @@ function debugmouse:draw3()
|
|||||||
pal()
|
pal()
|
||||||
end
|
end
|
||||||
|
|
||||||
-->8
|
|
||||||
-- save/load
|
|
||||||
|
|
||||||
persist={}
|
|
||||||
add(modules, persist)
|
|
||||||
add(real_modules, persist)
|
|
||||||
|
|
||||||
function persist:init0()
|
|
||||||
cartdata("ulimate_lizard_total_destruction_0_1")
|
|
||||||
self.init0 = self.read
|
|
||||||
self:read()
|
|
||||||
end
|
|
||||||
|
|
||||||
function persist:read()
|
|
||||||
self.ready=false
|
|
||||||
local m = dget(0) == 0
|
|
||||||
self.music = m
|
|
||||||
if m then music_on() else music_off() end
|
|
||||||
self.max_level = dget(1)
|
|
||||||
self.recent_level = dget(2)
|
|
||||||
self.ready=true
|
|
||||||
end
|
|
||||||
|
|
||||||
function persist:wipe()
|
|
||||||
for i=0,64 do
|
|
||||||
dset(i,0)
|
|
||||||
end
|
|
||||||
self:read()
|
|
||||||
end
|
|
||||||
|
|
||||||
function persist:lvlstart()
|
|
||||||
self.recent_level = level.ix
|
|
||||||
self.max_level = max(self.max_level, level.ix)
|
|
||||||
self:write()
|
|
||||||
end
|
|
||||||
|
|
||||||
function persist:write()
|
|
||||||
if (not self.ready) return
|
|
||||||
dset(0, self.music and 0 or -1)
|
|
||||||
dset(1, self.max_level)
|
|
||||||
dset(2, self.recent_level)
|
|
||||||
end
|
|
||||||
__gfx__
|
__gfx__
|
||||||
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110000000033300333
|
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110000000033300333
|
||||||
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110cc00cc033300333
|
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110cc00cc033300333
|
||||||
@ -1985,10 +1908,10 @@ eeee0000cc04405500444400efeeee5e11111111e5eeeefeeeeeeeeeeeeeeeeeffffffffffffffff
|
|||||||
000aa111991111103bbbbbb3eeeeeeeeeeeeeeeeeeeeeeeeff1ff1ffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
000aa111991111103bbbbbb3eeeeeeeeeeeeeeeeeeeeeeeeff1ff1ffffffffffffffffff00000000000000000000000000000000000000000000000000000000
|
||||||
0000000099100000f765000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111999999111111111
|
0000000099100000f765000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111999999111111111
|
||||||
00000000990000007700000000000000000000000000000000000000000000000000000000000000000000000000000019911991999999911999999119999999
|
00000000990000007700000000000000000000000000000000000000000000000000000000000000000000000000000019911991999999911999999119999999
|
||||||
00000000990000006060000000000000000bc0000090020000000000000000000000000000000000000000000000000019977991999999911999999119999999
|
00000000990000006060000000000000000000000000000000000000000000000000000000000000000000000000000019977991999999911999999119999999
|
||||||
00000000090000005005000000bbcc00000bc0000009200000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
00000000090000005005000000000000000000000000000000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
||||||
00000000aa0000000000000000ccbb00000cb0000002900000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
00000000aa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000019911991999117111991199111711999
|
||||||
0000000077a000000000000000000000000cb0000020090000000000000000000000000000000000000000000000000019999991999999911997799119999999
|
0000000077a000000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991999999911997799119999999
|
||||||
00000007777a00000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991999999911991199119999999
|
00000007777a00000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991999999911991199119999999
|
||||||
00044444444444000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991111111111111111111111111
|
00044444444444000000000000000000000000000000000000000000000000000000000000000000000000000000000019999991111111111111111111111111
|
||||||
44444444444004444444444444400444444444444440044444444444444004444444444444400444444444444440044444444444444004444444444444400444
|
44444444444004444444444444400444444444444440044444444444444004444444444444400444444444444440044444444444444004444444444444400444
|
||||||
@ -2218,7 +2141,7 @@ __label__
|
|||||||
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777
|
||||||
|
|
||||||
__gff__
|
__gff__
|
||||||
000000c0c0c0c0c0c0c0c0c0c0c00000000000c0c0c0c0c0c0c0c0c0202020200040c0c0c0c0c0c0c008080800000000404000000000080808080808c0c0c0c000000000080808080808080800000008000000000808080808080808000000000008080808080808080808080000000000080808080808080808080800000000
|
000000c0c0c0c0c0c0c0c0c0c0c00000000000c0c0c0c0c0c0c0c0c0202020200040c0c0c0c0c0c0c008080800000000404000000808080808080808c0c0c0c000000000080808080808080800000008000000000808080808080808000000000008080808080808080808080000000000080808080808080808080800000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
__map__
|
__map__
|
||||||
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d1203040404050d0d0d0d010d0d0d0d0d0d0d0d0d0d0d0d0d0d120d0d0d0d0d0d0d0d0d0d0d0d0d03043e0a040404050d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d
|
0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d1203040404050d0d0d0d010d0d0d0d0d0d0d0d0d0d0d0d0d0d120d0d0d0d0d0d0d0d0d0d0d0d0d03043e0a040404050d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d
|
||||||
|
Loading…
Reference in New Issue
Block a user