catch up to latest developments #10

Merged
kistaro merged 12 commits from pyrex/chameleonic:main into main 2022-12-21 06:50:14 +00:00
Showing only changes of commit 6be3fd51b0 - Show all commits

View File

@ -601,6 +601,9 @@ function level:can_move(
if is_player and self:win_at(mx0+dmx,my0+dmy) then if is_player and self:win_at(mx0+dmx,my0+dmy) then
return true return true
end end
if is_player and self:get_open_pit(mx0+dmx,my0+dmy) then
return wrongbleep:adequately_warned()
end
if self:mcoll(mx0+dmx,my0+dmy) then if self:mcoll(mx0+dmx,my0+dmy) then
return false return false
@ -768,7 +771,7 @@ function player:update()
}} }}
elseif kbd:btnp(5) then elseif kbd:btnp(5) then
if self.rope!=nil then if self.rope!=nil then
if (not self.rope:tug()) wrongbleep:bleep(7) if (not self.rope:tug()) wrongbleep:bleep(9)
end end
end end
end end
@ -812,8 +815,9 @@ function player:_fall()
end end
function player:draw() function player:draw()
local px=self.x*8+self.px local px=self.x*8+self.px+wrongbleep:vibrate()
local py=self.y*8+self.py local py=self.y*8+self.py+wrongbleep:vibrate()
local head=1-self.orienty local head=1-self.orienty
@ -911,7 +915,7 @@ function rope:update()
if (self.state.frame>=3) self.state={name="latched"} if (self.state.frame>=3) self.state={name="latched"}
elseif self.state.name=="latched" then elseif self.state.name=="latched" then
if (self.latch==nil) wrongbleep:bleep(3) self:destroy() return if (self.latch==nil) wrongbleep:bleep(5) self:destroy() return
if if
self.latch!=nil and self.latch!=nil and
@ -1598,15 +1602,24 @@ wrongbleep={}
add(real_modules,wrongbleep) add(real_modules,wrongbleep)
function wrongbleep:init() function wrongbleep:init()
self.duration=0 self.duration=0
self.continuous=0
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) sfx(63,3) if self.duration>0 then sfx(63,3) self.continuous+=1
self.duration=max(self.duration-1,-2) else self.continuous=0 end
self.duration=max(self.duration-1,-4)
end end
function wrongbleep:bleep(duration) function wrongbleep:bleep(duration)
self.duration+=duration or 2 self.duration+=duration or 2
end end
function wrongbleep:vibrate(duration)
if (self.continuous<10) return 0
return (rnd()*2-1)*min(self.continuous/10,2)
end
function wrongbleep:adequately_warned(duration)
return self.continuous>45
end
__gfx__ __gfx__