added a better normal map and an unlit example side by side

This commit is contained in:
Tim Anema 2014-12-04 16:56:48 -05:00
parent ada9857394
commit 5a60d1f1ca
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
-- Example: Animation Example -- Example: Animation Example
local LightWorld = require "lib" local LightWorld = require "lib"
local anim8 = require 'lib.anim8'
function love.load() function love.load()
x, y, scale = 0, 0, 1 x, y, scale = 0, 0, 1
@ -23,6 +24,9 @@ function love.load()
animation:setNormalMap(image_normal) animation:setNormalMap(image_normal)
grid = animation:newGrid(108, 140) grid = animation:newGrid(108, 140)
animation:addAnimation('run right', grid('1-8', 1), 0.1) animation:addAnimation('run right', grid('1-8', 1), 0.1)
local g = anim8.newGrid(108, 140, image:getWidth(), image:getHeight())
animation2 = anim8.newAnimation(g('1-8', 1), 0.1)
end end
function love.update(dt) function love.update(dt)
@ -46,6 +50,7 @@ function love.update(dt)
scale = scale + 0.01 scale = scale + 0.01
end end
animation2:update(dt)
lightWorld:update(dt) --only needed for animation lightWorld:update(dt) --only needed for animation
lightMouse:setPosition((love.mouse.getX() - x)/scale, (love.mouse.getY() - y)/scale) lightMouse:setPosition((love.mouse.getX() - x)/scale, (love.mouse.getY() - y)/scale)
end end
@ -59,6 +64,8 @@ function love.draw()
love.graphics.setColor(255, 255, 255) love.graphics.setColor(255, 255, 255)
love.graphics.rectangle("fill", -x/scale, -y/scale, love.graphics.getWidth()/scale, love.graphics.getHeight()/scale) love.graphics.rectangle("fill", -x/scale, -y/scale, love.graphics.getWidth()/scale, love.graphics.getHeight()/scale)
animation.animation:draw(image, 100, 100) animation.animation:draw(image, 100, 100)
animation2:draw(image, 200, 100)
end) end)
love.graphics.pop() love.graphics.pop()
end end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 194 KiB