From 50d38219834fc6a73fc2cf3dbe597fe42591c9dc Mon Sep 17 00:00:00 2001 From: Megadardery Date: Thu, 11 Feb 2016 00:22:41 +0200 Subject: [PATCH] Updating example 19 to reflect the changes in movements.lua --- examples/019_physics_move_objs_.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/019_physics_move_objs_.lua b/examples/019_physics_move_objs_.lua index 96e00f3..e86af28 100644 --- a/examples/019_physics_move_objs_.lua +++ b/examples/019_physics_move_objs_.lua @@ -1,6 +1,6 @@ -- 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") @@ -8,9 +8,9 @@ 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() @@ -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 \ No newline at end of file +end