mike: Rewrote paddle col detection; removed comments; less reliance on global variables
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user