mike: Rewrote paddle col detection; removed comments; less reliance on global variables

This commit is contained in:
2017-07-25 18:31:15 -07:00
parent ff386b2c75
commit beb04e1451
3 changed files with 61 additions and 33 deletions

View File

@@ -33,7 +33,7 @@ function half_speed(object_speed)
end
end
function check_keys(object)
function check_keys(object, screen)
local newObject = {}
newObject.x = object.x
newObject.y = object.y
@@ -49,14 +49,6 @@ function check_keys(object)
newObject.x = newObject.x - half_speed(newObject.speed)
end
-- if love.keyboard.isDown("up") then
-- newObject.y = newObject.y - newObject.speed
-- end
-- if love.keyboard.isDown("down") then
-- newObject.y = newObject.y + newObject.speed
-- end
if screen_col_detect(newObject, screen) then
return newObject
else
@@ -64,3 +56,5 @@ function check_keys(object)
end
end
--Inspired by https://love2d.org/wiki/BoundingBox.lua
--Returns true if boxes overlap