scenes/levels: use the bounceFactor variable name

This commit is contained in:
Kazhnuz 2019-06-05 22:29:26 +02:00
parent 3da9c66cc9
commit a07316f4d1
2 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ function Debris:new(world, x, y, speed, dir, timelimit)
self.timelimit = timelimit or 2
self:setMotionDirection(dir, speed)
self.grav = 1
self.bounce = 0.5
self.bounceFactor = 0.5
self.frc = 0.046875*60*1.5
self.rotation = love.math.random(0, 360)
end

View File

@ -20,7 +20,7 @@ function Entity:initPhysics(world, collType, x, y, w, h)
self.xsp = 0
self.ysp = 0
self.bounce = 0
self.bounceFactor = 0
self.grav = 0
self.frc = 0
@ -39,8 +39,8 @@ function Entity:update(dt)
end
function Entity:canBounce(bounce)
self.bounce = bounce
function Entity:canBounce(bounceFactor)
self.bounceFactor = bounceFactor
end
function Entity:setMotion(xsp, ysp)
@ -76,11 +76,11 @@ 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.bounce
xsp = -xsp * self.bounceFactor
end
if (ny < 0 and ysp > 0) or (ny > 0 and ysp < 0) then
ysp = -ysp * self.bounce
ysp = -ysp * self.bounceFactor
end
self.xsp, self.ysp = xsp, ysp