love:mike init
This commit is contained in:
43
love/mike/main.lua
Normal file
43
love/mike/main.lua
Normal file
@@ -0,0 +1,43 @@
|
||||
require "keys"
|
||||
|
||||
-- Make this more functional. It shouldn't depend on global state.
|
||||
function col_detect(object, display)
|
||||
if not (object.x >= -1 and
|
||||
object.x <= (display.width - object.width)) then
|
||||
return false
|
||||
end
|
||||
|
||||
if not (object.y >= -1 and
|
||||
object.y <= (display.height - object.height)) then
|
||||
return false
|
||||
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function love.load()
|
||||
saveFile = "test.lua"
|
||||
|
||||
-- Create a table and grab the screen width/height
|
||||
screen = {}
|
||||
screen.width = love.graphics.getWidth()
|
||||
screen.height = love.graphics.getHeight()
|
||||
|
||||
-- Create a table to hold all the player data
|
||||
player = {}
|
||||
player.x = 250
|
||||
player.y = 250
|
||||
|
||||
player.width = 25
|
||||
player.height = 5
|
||||
|
||||
player.speed = 5
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
player = check_keys(player)
|
||||
end
|
||||
function love.draw()
|
||||
love.graphics.rectangle("line", player.x, player.y, player.width, player.height)
|
||||
end
|
||||
Reference in New Issue
Block a user