love:mike: Blocked player y movement; changed player position
This commit is contained in:
parent
65c418d006
commit
7e844925e8
@ -35,13 +35,13 @@ function check_keys(object)
|
|||||||
newObject.x = newObject.x - newObject.speed
|
newObject.x = newObject.x - newObject.speed
|
||||||
end
|
end
|
||||||
|
|
||||||
if love.keyboard.isDown("up") then
|
-- if love.keyboard.isDown("up") then
|
||||||
newObject.y = newObject.y - newObject.speed
|
-- newObject.y = newObject.y - newObject.speed
|
||||||
end
|
-- end
|
||||||
|
|
||||||
if love.keyboard.isDown("down") then
|
-- if love.keyboard.isDown("down") then
|
||||||
newObject.y = newObject.y + newObject.speed
|
-- newObject.y = newObject.y + newObject.speed
|
||||||
end
|
-- end
|
||||||
|
|
||||||
if col_detect(newObject, screen) then
|
if col_detect(newObject, screen) then
|
||||||
return newObject
|
return newObject
|
||||||
|
@ -10,7 +10,6 @@ function col_detect(object, display)
|
|||||||
if not (object.y >= -1 and
|
if not (object.y >= -1 and
|
||||||
object.y <= (display.height - object.height)) then
|
object.y <= (display.height - object.height)) then
|
||||||
return false
|
return false
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@ -26,8 +25,8 @@ function love.load()
|
|||||||
|
|
||||||
-- Create a table to hold all the player data
|
-- Create a table to hold all the player data
|
||||||
player = {}
|
player = {}
|
||||||
player.x = 250
|
player.x = screen.width /2
|
||||||
player.y = 250
|
player.y = screen.height - 50
|
||||||
|
|
||||||
player.width = 25
|
player.width = 25
|
||||||
player.height = 5
|
player.height = 5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user