diff main.lua @ 0:716ff40413d2

initial commit
author Radomir Dopieralski <sheep-devel@sheep.art.pl>
date Sat, 15 Dec 2012 10:23:11 +0100
parents
children 0c46edeabad6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.lua	Sat Dec 15 10:23:11 2012 +0100
@@ -0,0 +1,31 @@
+local anim8 = require("anim8") 
+local sprite = require("sprite") 
+
+local sprites = {}
+
+function love.load()
+    local VILLAIN_IMAGE = love.graphics.newImage('villain.png')
+    local CIVILIAN_IMAGE = love.graphics.newImage('civilian.png')
+    local grid = anim8.newGrid(64, 64, 128, 128)
+    table.insert(sprites, sprite.newSprite(
+        255,
+        255,
+        VILLAIN_IMAGE,
+        anim8.newAnimation('loop', grid('1-2,1'), 0.25)
+    ))
+end
+
+
+function love.draw()
+    for k, sprite in pairs(sprites) do
+        sprite:draw()
+    end
+end
+
+
+function love.update(dt)
+    for k, sprite in pairs(sprites) do
+        sprite:update(dt)
+    end
+    table.sort(sprites, function (a, b) return a.y < b.y end)
+end