this creates a blank black screen and nothing else
main.lua
Code: Select all
function love.load()
require("color")
menu = false
end
function love.update(dt)
if menu == false then
require("player")
end
end
function love.draw()
end
Code: Select all
function love.load()
-- player values
player = {}
player.x = 0
player.y = 0
player.w = 32
player.h = 32
player.items = {}
player.items[1] = BasicWolfTrap
player.speed = 1
-- animations
player[1] = "blank1"
player[2] = "blank2"
player[3] = "blank3"
-- first item of the player
BasicWolfTrap = {}
BasicWolfTrap[1] = 10
BasicWolfTrap[2] = "Trap"
BasicWolfTrap[3] = "blank"
keymap = {}
keymap[1] = love.keyboard.isDown("down")
keymap[2] = love.keyboard.isDown("up")
keymap[3] = love.keyboard.isDown("left")
keymap[4] = love.keyboard.isDown("right")
end
function CheckCollision(x1,y1,w1,h1, x2,y2,w2,h2)
--creates a collision rectangle
local bx1,by1,bx2, by2 = x1 + w1 ,y1 + h1, x2 + w2, y2 + h2
return x1 < x2+w2 and
x2 < x1+w1 and
y1 < y2+h2 and
y2 < y1+h1
end
function love.update(dt)
-- use this to call keyboard operations
if keymap[1]then
player.y = player.y + player.speed
end
if keymap[2]then
player.y = player.y - player.speed
end
if keymap[3]then
player.x = player.x - player.speed
end
if keymap[4]then
player.x = player.x - player.speed
end
end
function love.draw()
love.graphics.setColor(indigo)
-- draw using the pallet required
love.graphics.rectangle("fill", player.x, player.y)
end
Code: Select all
function love.load()
indigo = {77, 0, 255, 255}
pastel = {93, 138, 205}
green = {88, 236, 127}
olive = {15, 111, 54}
yellow = {167, 226, 4}
orange = {196, 130, 44}
rouge = {222, 26, 80}
rose = {222, 28, 183}
end
function love.update(...)
end
function love.draw(...)
end