ff to current state #6

Merged
kistaro merged 27 commits from pyrex/chameleonic:main into main 2022-12-19 07:03:33 +00:00
Showing only changes of commit 14e37ba9dd - Show all commits

View File

@ -579,6 +579,14 @@ function player:update()
-- todo: other anim stuff -- todo: other anim stuff
xs[#xs].px=0 xs[#xs].px=0
xs[#xs].py=0 xs[#xs].py=0
xs[1].update=function(s)
if (s.rope) s.rope:prevent_highlight(true)
return true
end
xs[#xs].update=function(s)
if (s.rope) s.rope:prevent_highlight(false)
return true
end
return xs return xs
end end
@ -871,7 +879,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()) highlight=nil if (self:busy() or self._prevent_highlight) 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
@ -1392,6 +1400,15 @@ function rope:tug()
self:_tidy_up_gen() self:_tidy_up_gen()
end end
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
function rope:_tug(hypothetically) function rope:_tug(hypothetically)
local ancs=self:_anchors_simplified() local ancs=self:_anchors_simplified()
local touched={} local touched={}