Skip to content

Commit

Permalink
Move velocity set to after positioning
Browse files Browse the repository at this point in the history
  • Loading branch information
GymbylCoding committed May 28, 2015
1 parent 1bb041e commit 4f8afaf
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions CBE/cbe_core/vent_core/core.lua
Expand Up @@ -156,37 +156,6 @@ function vent_core.new(params)
p = nil
end
--------------------------------------------------------------------------
-- Set Velocity
--------------------------------------------------------------------------
if vent.useVelFunction then
local xVel, yVel = vent.velFunction(p, vent, vent.content)
p._cbe_reserved.xVel, p._cbe_reserved.yVel = xVel, yVel
else
local velocity
if vent.cycleAngle then
if vent.preCalculateAngles then
velocity = vent.calculatedAngles[vent.curAngle]
else
local angle = vent.calculatedAngles[vent.curAngle]
velocity = forcesByAngle(vent.velocity, angle)
end
vent.curAngle = (((vent.curAngle + vent.angleIncr) - 1) % (#vent.calculatedAngles)) + 1
else
if vent.preCalculateAngles then
velocity = either(vent.calculatedAngles)
else
local angle = either(vent.calculatedAngles)
velocity = forcesByAngle(vent.velocity, angle)
end
end
p._cbe_reserved.xVel, p._cbe_reserved.yVel = velocity.x, velocity.y
end
if not onCreationExecuted and vent.onCreationTime == "afterVel" then vent.onCreation(p, vent, vent.content) onCreationExecuted = true end
--------------------------------------------------------------------------
-- Set Color
--------------------------------------------------------------------------
Expand Down Expand Up @@ -265,6 +234,38 @@ function vent_core.new(params)
if not onCreationExecuted and vent.onCreationTime == "afterPosition" then vent.onCreation(p, vent, vent.content) onCreationExecuted = true end
--------------------------------------------------------------------------
-- Set Velocity
--------------------------------------------------------------------------
if vent.useVelFunction then
local xVel, yVel = vent.velFunction(p, vent, vent.content)
p._cbe_reserved.xVel, p._cbe_reserved.yVel = xVel, yVel
else
local velocity
if vent.cycleAngle then
if vent.preCalculateAngles then
velocity = vent.calculatedAngles[vent.curAngle]
else
local angle = vent.calculatedAngles[vent.curAngle]
velocity = forcesByAngle(vent.velocity, angle)
end
vent.curAngle = (((vent.curAngle + vent.angleIncr) - 1) % (#vent.calculatedAngles)) + 1
else
if vent.preCalculateAngles then
velocity = either(vent.calculatedAngles)
else
local angle = either(vent.calculatedAngles)
velocity = forcesByAngle(vent.velocity, angle)
end
end
p._cbe_reserved.xVel, p._cbe_reserved.yVel = velocity.x, velocity.y
end
if not onCreationExecuted and vent.onCreationTime == "afterVel" then vent.onCreation(p, vent, vent.content) onCreationExecuted = true end
--------------------------------------------------------------------------
-- Set Up Particle Transition
--------------------------------------------------------------------------
Expand Down

0 comments on commit 4f8afaf

Please sign in to comment.