From 0efeb7392cd56f80a004198301761d564ba950f8 Mon Sep 17 00:00:00 2001 From: khuxkm fbexl Date: Tue, 4 Dec 2018 10:50:59 -0500 Subject: [PATCH] Initial commit --- Makefile | 8 ++++++++ README.md | 3 +++ src/conf.lua | 8 ++++++++ src/main.lua | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 src/conf.lua create mode 100644 src/main.lua diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..addfaa7 --- /dev/null +++ b/Makefile @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e1a1a43 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# game + +IDK what I'm gonna do with this. diff --git a/src/conf.lua b/src/conf.lua new file mode 100644 index 0000000..3b27ed5 --- /dev/null +++ b/src/conf.lua @@ -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 diff --git a/src/main.lua b/src/main.lua new file mode 100644 index 0000000..8cce267 --- /dev/null +++ b/src/main.lua @@ -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