From 4fc1cbaf3a8b98529baccfc308ef8768640e5276 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Mon, 28 Jan 2019 20:05:50 -0500 Subject: [PATCH] Begin work on puzzle 2 --- base.p8 | 50 +++++++++++++++++++++++++------------------------- main.lua | 12 ++++++------ mapdata.lua | 9 ++------- 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/base.p8 b/base.p8 index 6a2dfa3..bd0f731 100644 --- a/base.p8 +++ b/base.p8 @@ -3,14 +3,14 @@ version 16 __lua__ __gfx__ -bbbbbbbbbbbbbbbb00bbbb0000bbbb00555555551111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -bbbbbbbbbffffffb00bfff0000fffb00566666651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -bbbbbbbbffffffff00ffff0000ffff00566666651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -bbbbbbbbf7cffc7f00f7cf0000fc7f00566556651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -ffffffffffffffff00ffff0000ffff00566556651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -88888888888888880088880000888800566666651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -88888888888888880088880000888800566666651111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 -dddddddddddddddd00dddd0000dddd00555555551111111100000000000000000000000000000000000000000000000000000000000000000000000000000000 +bbbbbbbbbbbbbbbb00bbbb0000bbbb00555555551111111157777775766666677666666700000000000000000000000000000000000000000000000000000000 +bbbbbbbbbffffffb00bfff0000fffb00566666651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +bbbbbbbbffffffff00ffff0000ffff00566666651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +bbbbbbbbf7cffc7f00f7cf0000fc7f00566556651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +ffffffffffffffff00ffff0000ffff00566556651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +88888888888888880088880000888800566666651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +88888888888888880088880000888800566666651111111176666667766666677666666700000000000000000000000000000000000000000000000000000000 +dddddddddddddddd00dddd0000dddd00555555551111111176666667766666675777777500000000000000000000000000000000000000000000000000000000 99999999555555559999999559999999999999959999999999999999999999995999999999999995599999995555555555555555000000000000000000000000 99999999999999999999999599999999999999999999999999999999999999995999999999999995599999999999999559999999000000000000000000000000 99999999999999999999999599999999999999999999999999999999999999995999999999999995599999999999999559999999000000000000000000000000 @@ -68,22 +68,22 @@ dddddddddddddddd00dddd0000dddd00555555551111111100000000000000000000000000000000 07777770077777700777777007777770000000000075570000000000000000000000000000000000000000000000000000000000000000000000000000000000 00755700007557000000000000000000000000000075570000000000000000000000000000000000000000000000000000000000000000000000000000000000 __gff__ -0000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000001010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 __map__ -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000040000000000050505000000000000000400000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000001c11111111111111111111111111111111111111050505111111111111111111111111111111111111111111111111111111111b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000001810101010101010101010101010101010101010050505101010101010101010101010101010101010101010101010101010101200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000001810101010101010101010101010101010101010050505101010101010101010101010101010101010101010101010101010101200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000001a17171717171717171717171717171717171717050505171717171717171717171717171717171717171717171717171717171900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000040000000000050505000000000000000400000000000505050000000004000400040004070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000001c11111111111111111111111111111111111111050505111111111111111111111111111111111111111111111111111111071111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000001810101010101010101010101010101010101010050505101010101010101010101010101010101010101010101010101010071010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000001810101010101010101010101010101010101010050505101010101010101010101010101010101010101010101010101010071010101010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000001a17171717171717171717171717171717171717050505171717171717171717171717171717171717171717171717171717071717171717171700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000050505000000000000000000000000000505050000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/main.lua b/main.lua index 1341576..4cfd1b3 100644 --- a/main.lua +++ b/main.lua @@ -35,8 +35,8 @@ function change_map(n) end function can_trigger(tx,ty,tf) - tx = tx+(tf==2 and 8 or (tf==3 and -8 or 0)) - ty = ty+(tf==1 and 8 or (tf==0 and -8 or 0)) + tx = tx+(tf==2 and 1 or (tf==3 and -1 or 0)) + ty = ty+(tf==1 and 1 or (tf==0 and -1 or 0)) t = mapdata[mapn].triggers for i=1,#t do if t[i][1]==tx and t[i][2]==ty then return true end @@ -45,8 +45,8 @@ function can_trigger(tx,ty,tf) end function activate(tx,ty,tf) - tx = tx+(tf==2 and 8 or (tf==3 and -8 or 0)) - ty = ty+(tf==1 and 8 or (tf==0 and -8 or 0)) + tx = tx+(tf==2 and 1 or (tf==3 and -1 or 0)) + ty = ty+(tf==1 and 1 or (tf==0 and -1 or 0)) t = mapdata[mapn].triggers for i=1,#t do if t[i][1]==tx and t[i][2]==ty then @@ -131,8 +131,8 @@ function _update() textbox.open = false textbox.cb() else - if can_trigger(x,y,f) then - activate(x,y,f) + if can_trigger(flr(x/8),flr(y/8),f) then + activate(flr(x/8),flr(y/8),f) end end end diff --git a/mapdata.lua b/mapdata.lua index bd276e1..4b7e009 100644 --- a/mapdata.lua +++ b/mapdata.lua @@ -1,10 +1,5 @@ ---!define debug yes - ---blazzle ---by minerobber9000 - mapdata = { {x=0,y=0,e=2,triggers={}}, - {x=1,y=0,w=1,triggers={{4*8,5*8,function(m) otextbox("the switch clicks.",function() m.x = 2 end) m.triggers[1][3] = function() otextbox("nothing happens.") end m.e = 3 end}},onload=function(m) if not m.e then qtextbox({"oh no!","the path is flooded!","see that switch?","press it!"}) end end}, - {x=3,y=0,w=2,triggers={}} + {x=1,y=0,w=1,triggers={{4,5,function(m) otextbox("the switch clicks.",function() m.x = 2 end) m.triggers[1][3] = function() otextbox("nothing happens.") end m.e = 3 end}},onload=function(m) if not m.e then qtextbox({"oh no!","the path is flooded!","see that switch?","press it!"}) end end}, + {x=3,y=0,w=2,triggers={{1,5,function(m) otextbox("switch 1") end},{3,5,function(m) otextbox("switch 2") end},{5,5,function(m) otextbox("switch 3") end},{7,5,function(m) otextbox("switch 4") end}}} }