diff --git a/chameleonic.p8 b/chameleonic.p8 index af7f56e..f4a065b 100644 --- a/chameleonic.p8 +++ b/chameleonic.p8 @@ -319,7 +319,6 @@ function level:advance() end normpal = {[1]=0,[8]=0,[14]=0} -pitpal = {[8]=0,[13]=3,[4]=3,[7]=3} function level:draw() cls(5) fillp() @@ -336,11 +335,7 @@ function level:draw() spr(pit.s,px,py) if pit.full then - pal(pitpal) - palt(0,false) - spr(79,pit.px,pit.py) - pal() - pal(normpal) + spr(15,pit.px,pit.py) end palt(8,true) spr(pit.s,px,py) @@ -885,6 +880,7 @@ function rope:new( id=0, state={name="cast",frame=0}, latch=latch, + flicker_t=t(), } r.src=src r.dst=dst @@ -970,7 +966,7 @@ function rope:affected_src_xy(artificial_px,artificial_py) end function rope:draw(artificial_px,artificial_py) - local points,highlight=self:_tug(true) + local points,highlight,hypo_ops=self:_tug(true) local n,perc_to_show,from_end = self.state.name,1.0 if (n=="done") return if (n=="cast") perc_to_show=self.state.frame/2 @@ -1040,6 +1036,16 @@ function rope:draw(artificial_px,artificial_py) color() end + -- hypothetical + local time=t()-self.flicker_t + if n=="latched" and time>0 and time%0.5>0.25 and not level:busy() then + for o in all(hypo_ops) do + local mx0,my0,dmx,dmy=unpack(o) + local px1,py1=(mx0+dmx)*8,(my0+dmy)*8 + spr(14,px1,py1) + end + end + -- debug --[[ local n1=self.src @@ -1486,7 +1492,9 @@ end function rope:tug() if (not self:latched()) return - return self:_tug() + local success=self:_tug() + if (success) self.flicker_t=t() + return success end function rope:_tug(hypothetically) @@ -1506,19 +1514,16 @@ function rope:_tug(hypothetically) local ops=ops_to_do if #ops>0 then - if (hypothetically) return ancs,i-1 + if (hypothetically) return ancs,i-1,ops - local dmx,dmy=ops[1].dmx,ops[1].dmy - for o in all(ops) do - level:tug_crate(o.mx,o.my,o.dmx,o.dmy) - end + for o in all(ops) do level:tug_crate(unpack(o)) end return true end end local latch=self.latch if latch and latch.el=="eyehook" then - if (hypothetically) return ancs,0 + if (hypothetically) return ancs,0,{} player.todo={{ update=function(s) if not s.rope or s.rope:done() then @@ -1562,7 +1567,7 @@ function rope:_tug(hypothetically) if not invalid_move and level:can_move(false,mx0,my0,dmx,dmy,1,0) then - if (hypothetically) return ancs,0 + if (hypothetically) return ancs,0,{{mx0,my0,dmx,dmy}} level:tug_crate(mx0,my0,dmx,dmy) return true @@ -1608,7 +1613,7 @@ function rope:_calc_push( end for my=my0,my1,smy do - add(ops,{mx=mx,my=my,dmx=dmx,dmy=0}) + add(ops,{mx,my,dmx,0}) end end @@ -1635,18 +1640,19 @@ function rope:_calc_push( end for mx=mx0,mx1,smx do - add(ops,{mx=mx,my=my,dmx=0,dmy=dmy}) + add(ops,{mx,my,0,dmy}) end end local ops2={} for o in all(ops) do - if not level:mcoll(o.mx,o.my) then + local mx,my,dmx,dmy=unpack(o) + if not level:mcoll(mx,my) then -- great! else - local crate=level:get_crate(o.mx,o.my) + local crate=level:get_crate(mx,my) if crate then - if not level:can_move(false,o.mx,o.my,o.dmx,o.dmy,0,0) then + if not level:can_move(false,mx,my,dmx,dmy,0,0) then break end else @@ -1864,14 +1870,14 @@ function debugmouse:draw3() end __gfx__ -000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110005000000000000 -003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110000500000000000 -099333990039932009333339effeeeeeeeeeeeeeeeeeeffee5eeeeeeeeeeee5eff1ff1ffff111111ff1111ff111111ffdddddddd111111110000000000000000 -09a333a9033a932009333339efee33e3333e333e3333eefee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd111111115005005000000000 -023333323333320000222220efe333e3333e333e33333efee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd111111110500500500000000 -002222200000220000222220efe33eeeeeeeeeeeeee33efeeee33eeeeee33eeeff1111ffff111111ff1ff1ff111111ffdddddddd111111110000000000000000 -000222c002222c0000022200efeeee555e555e55e5eeeefee5eeeeffffeeee5effffffffffffffffff1ff1ffffffffffdddddddd111111110005000000000000 -00000cc00000cc0000000cc0efe33e5eeeeeeeeee5e33efee5e33efeefe33e5e1ffffff11fffffffff1ff1fffffffff1dddddddd111111110000500000000000 +000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110000000033300333 +003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110cc00cc033300333 +099333990039932009333339effeeeeeeeeeeeeeeeeeeffee5eeeeeeeeeeee5eff1ff1ffff111111ff1111ff111111ffdddddddd111111110cccccc033333333 +09a333a9033a932009333339efee33e3333e333e3333eefee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd1111111100c00c0000300300 +023333323333320000222220efe333e3333e333e33333efee5e333e333333e5eff1ff1ffff1fffffff1ff1fffffff1ffdddddddd1111111100c00c0000300300 +002222200000220000222220efe33eeeeeeeeeeeeee33efeeee33eeeeee33eeeff1111ffff111111ff1ff1ff111111ffdddddddd111111110cccccc033333333 +000222c002222c0000022200efeeee555e555e55e5eeeefee5eeeeffffeeee5effffffffffffffffff1ff1ffffffffffdddddddd111111110cc00cc033300333 +00000cc00000cc0000000cc0efe33e5eeeeeeeeee5e33efee5e33efeefe33e5e1ffffff11fffffffff1ff1fffffffff1dddddddd111111110000000033300333 0000ff000000000000000000efe33e5e11111111e5e33efee5e33efeefe33e5eff1ff1ffffffffffffffffffffffffff88888888555555555555555588888888 000f00f0000000000aa00aa0efe33eee11ffff11eee33efeeee33effffe33e5eff1ff1ffffffffffffffffffffffffff88888888558855885588558888888888 00d0000f000000000aaaaaa0efe33e5e1ff11ff1e5e33efee5e33eeeeee33eeeff1ff1fffff11111ffffffff11111fff88888888888888888888888888888888