forked from pyrex/chameleonic
Prevent highlight flicker for rope
This commit is contained in:
parent
8d37dbef80
commit
14e37ba9dd
@ -579,6 +579,14 @@ function player:update()
|
||||
-- todo: other anim stuff
|
||||
xs[#xs].px=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
|
||||
end
|
||||
|
||||
@ -871,7 +879,7 @@ end
|
||||
|
||||
function rope:draw(artificial_dx,artificial_dy)
|
||||
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
|
||||
local perc_to_show=1.0
|
||||
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()
|
||||
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)
|
||||
local ancs=self:_anchors_simplified()
|
||||
local touched={}
|
||||
|
Loading…
Reference in New Issue
Block a user