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