Skip to content

Commit

Permalink
Updating example 19 to reflect the changes in movements.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmed-dardery committed Feb 10, 2016
1 parent a25a4d4 commit 50d3821
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/019_physics_move_objs_.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
-- Example: Moving objects to a specific point
--[[Description:
Move an object to a target point, with acceleration, deacceleration (traction)
Move an object to a target point, with acceleration, deceleration (traction)
and a set top speed.
]]
require ("movements")
x, y = 400, 300
function love.load()
SPEED = 500
ACCELERATION = 250
DEACCELERATION = 0
DECELERATION = 0
image = love.graphics.newImage("assets/love-ball.png")
move=mega.movements.newMove(ACCELERATION,DEACCELERATION,SPEED,x,y)
move=mega.movements.newMove(ACCELERATION,DECELERATION,SPEED,x,y)
end

function love.draw()
Expand All @@ -28,11 +28,12 @@ function love.update(dt)
if love.mouse.isDown(1) then
move:setTarget(love.mouse.getPosition())
elseif love.mouse.isDown(3) then
move:setPosition(love.mouse.getPosition())
move:setTarget(love.mouse.getPosition())
move:snapToTarget()
elseif love.mouse.isDown(2) then
move:setTarget(nil)
end

move:advance(dt)
x,y=move:getPosition()
end
end

0 comments on commit 50d3821

Please sign in to comment.