Compare commits

..

2 Commits

Author SHA1 Message Date
5831cdf4e8 Remove old flash-prevention code 2022-12-19 16:39:30 -08:00
2cdbb3d3f5 Bleep on wrong actions 2022-12-19 16:38:21 -08:00

View File

@ -207,6 +207,7 @@ function title:update()
music(0) music(0)
end end
end end
-->8 -->8
--level behaviors --level behaviors
level={} level={}
@ -669,19 +670,19 @@ function player:update()
if kbd:btn(0) then if kbd:btn(0) then
if level:can_move(true,self.x,self.y,-1,0,0,2) then if level:can_move(true,self.x,self.y,-1,0,0,2) then
self.todo=f4({{orientx=-1,orienty=0,px=-2},{px=-7},{x=self.x-1}}) self.todo=f4({{orientx=-1,orienty=0,px=-2},{px=-7},{x=self.x-1}})
end else wrongbleep:bleep() end
elseif kbd:btn(1) then elseif kbd:btn(1) then
if level:can_move(true,self.x,self.y,1,0,0,2) then if level:can_move(true,self.x,self.y,1,0,0,2) then
self.todo=f4({{orientx=1,orienty=0,px=2},{px=7},{x=self.x+1}}) self.todo=f4({{orientx=1,orienty=0,px=2},{px=7},{x=self.x+1}})
end else wrongbleep:bleep() end
elseif kbd:btn(2) then elseif kbd:btn(2) then
if level:can_move(true,self.x,self.y,0,-1,0,2) then if level:can_move(true,self.x,self.y,0,-1,0,2) then
self.todo=f4({{orienty=-1,py=-2},{py=-7},{y=self.y-1}}) self.todo=f4({{orienty=-1,py=-2},{py=-7},{y=self.y-1}})
end else wrongbleep:bleep() end
elseif kbd:btn(3) then elseif kbd:btn(3) then
if level:can_move(true,self.x,self.y,0,1,0,2) then if level:can_move(true,self.x,self.y,0,1,0,2) then
self.todo=f4({{orienty=1,py=2},{py=7},{y=self.y+1}}) self.todo=f4({{orienty=1,py=2},{py=7},{y=self.y+1}})
end else wrongbleep:bleep() end
elseif self.rope==nil and kbd:btnr(4) then elseif self.rope==nil and kbd:btnr(4) then
local rx,ry,rx2,ry2=self:_rope_pos() local rx,ry,rx2,ry2=self:_rope_pos()
local dx,dy=12*self.orientx,12*self.orienty local dx,dy=12*self.orientx,12*self.orienty
@ -695,13 +696,12 @@ function player:update()
}} }}
elseif kbd:btnp(5) then elseif kbd:btnp(5) then
if self.rope!=nil then if self.rope!=nil then
self.rope:tug() if (not self.rope:tug()) wrongbleep:bleep(7)
end end
end end
end end
end end
if (self.rope) self.rope:prevent_highlight(#self.todo>0)
_apply(self,self.todo) _apply(self,self.todo)
if self.rope then if self.rope then
@ -926,7 +926,7 @@ end
function rope:draw(artificial_dx,artificial_dy) function rope:draw(artificial_dx,artificial_dy)
local points,highlight=self:_tug(true) local points,highlight=self:_tug(true)
if (self:busy() or self._prevent_highlight) highlight=nil if (self:busy()) highlight=nil
if (self.state.name=="done") return if (self.state.name=="done") return
local perc_to_show=1.0 local perc_to_show=1.0
if (self.state.name=="destroy") perc_to_show=(1.0-self.state.frame/5)^2 if (self.state.name=="destroy") perc_to_show=(1.0-self.state.frame/5)^2
@ -1433,17 +1433,9 @@ end
function rope:tug() function rope:tug()
self:_tidy_up_gen() self:_tidy_up_gen()
if (not self:latched()) return if (not self:latched()) return
self:_tug() local rc=self:_tug()
self:_tidy_up_gen() self:_tidy_up_gen()
end return rc
function rope:prevent_highlight(prevent)
if prevent then
local points,highlight=self:_tug(true)
if (self:busy() or highlight==nil) self._prevent_highlight=true
else
self._prevent_highlight=false
end
end end
function rope:_tug(hypothetically) function rope:_tug(hypothetically)
@ -1502,14 +1494,12 @@ function rope:_tug(hypothetically)
for node=ancs[i-1].ix-1,ancs[i].ix+1 do for node=ancs[i-1].ix-1,ancs[i].ix+1 do
local anc=self:_anc(node) local anc=self:_anc(node)
end end
return return true
end end
end end
local latch=self.latch local latch=self.latch
if (latch==nil) return ancs,nil if latch!=nil and latch.el=="crate" then
if latch.el=="crate" then
local dmx,dmy= local dmx,dmy=
sgn0(latch.dx), sgn0(latch.dx),
sgn0(latch.dy) sgn0(latch.dy)
@ -1550,10 +1540,12 @@ function rope:_tug(hypothetically)
) )
-- be busy for 4 ticks while the crate moves -- be busy for 4 ticks while the crate moves
self:_anc(0).todo={{},{},{},{},{}} self:_anc(0).todo={{},{},{},{},{}}
return true
end end
end end
return ancs,nil if (hypothetically) return ancs,nil
return false
end end
function rope:_calc_push( function rope:_calc_push(
@ -1663,6 +1655,22 @@ function rope:_anchors_simplified()
return points return points
end end
-->8
--wrongbleeps
wrongbleep={}
add(real_modules,wrongbleep)
function wrongbleep:init()
self.duration=0
end
function wrongbleep:update()
if (self.duration>5) self.duration=5
if (self.duration>0) sfx(63,3)
self.duration=max(self.duration-1,-2)
end
function wrongbleep:bleep(duration)
self.duration+=duration or 2
end
__gfx__ __gfx__
000030000000002200003000000cc0cc0cccccccccccccccccccccccccccccccc0bb0000000000000000000000000000dddddddd000000000005000000000000 000030000000002200003000000cc0cc0cccccccccccccccccccccccccccccccc0bb0000000000000000000000000000dddddddd000000000005000000000000
@ -1884,6 +1892,58 @@ __sfx__
012800000000000000010550805501055080050105508055000550800000000070550005507055000550705500000000000105508055010550805501055080550005500000070550000000055000000705500000 012800000000000000010550805501055080050105508055000550800000000070550005507055000550705500000000000105508055010550805501055080550005500000070550000000055000000705500000
01280010183541a3541b3540000000000000002235400000213540000026354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 01280010183541a3541b3540000000000000002235400000213540000026354000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
01281000080050f005080550f05501055000000f055000000e3550000013355000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 01281000080050f005080550f05501055000000f055000000e3550000013355000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010300000015000250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__music__ __music__
01 00014344 01 00014344
00 02034344 00 02034344