Initial commit
This commit is contained in:
commit
0efeb7392c
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue