Initial commit

This commit is contained in:
Robert Miles 2018-12-04 10:50:59 -05:00
commit 0efeb7392c
4 changed files with 58 additions and 0 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
game.love: $(wildcard src/*)
cd src && zip -9 -r ../game.love *
.PHONY: clean test
clean:
rm game.love
test:
@love game.love

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# game
IDK what I'm gonna do with this.

8
src/conf.lua Normal file
View File

@ -0,0 +1,8 @@
local conf = {}
function love.conf(t)
t.window.title = "AAAA"
t.window.width = 256*2.5
t.window.height = 240*2.5
conf.properties = t
end
return conf

39
src/main.lua Normal file
View File

@ -0,0 +1,39 @@
_G.CONFIG = require("conf").properties
local player = {x=0,y=0,s=4}
function love.load()
_G.scr = love.graphics.newCanvas(256,240)
end
function move(coordinate,amount)
player[coordinate] = player[coordinate]+amount
end
function update()
if love.keyboard.isDown("left") then move("x",-(player.s/2)) end
if love.keyboard.isDown("right") then move("x",(player.s/2)) end
if love.keyboard.isDown("up") then move("y",-(player.s/2)) end
if love.keyboard.isDown("down") then move("y",(player.s/2)) end
if love.keyboard.isDown("a") then move("s",1) end
if love.keyboard.isDown("z") then move("s",-1) end
end
local t = 0
function love.update(dt)
t = t + dt
while t>(1/30) do
t = t - (1/30)
update()
end
end
function love.draw()
love.graphics.setCanvas(scr)
love.graphics.setColor(0,0,0)
love.graphics.rectangle("fill",0,0,256,240)
love.graphics.setColor(1,0,0)
love.graphics.rectangle("fill",player.x,player.y,player.s,player.s)
love.graphics.setCanvas()
love.graphics.setBackgroundColor(0,0,0)
love.graphics.setColor(1,1,1)
love.graphics.draw(scr,0,0,0,2.5,2.5)
end