scenes/levels: use actor2D changeSpeedToCollisionNormal
This commit is contained in:
parent
caca456614
commit
83788cc075
|
@ -70,20 +70,6 @@ function Entity:friction(dt)
|
|||
end
|
||||
end
|
||||
|
||||
function Entity:changeSpeedToCollisionNormal(nx, ny)
|
||||
local xsp, ysp = self.xsp, self.ysp
|
||||
|
||||
if (nx < 0 and xsp > 0) or (nx > 0 and xsp < 0) then
|
||||
xsp = -xsp * self.bounceFactor
|
||||
end
|
||||
|
||||
if (ny < 0 and ysp > 0) or (ny > 0 and ysp < 0) then
|
||||
ysp = -ysp * self.bounceFactor
|
||||
end
|
||||
|
||||
self.xsp, self.ysp = xsp, ysp
|
||||
end
|
||||
|
||||
function Entity:purge()
|
||||
self.world:removeActor(self)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue