Animation Create Question
Posted: Sat Nov 14, 2009 8:46 am
I can't create Animation by the attachment PNG files.
The code like the "Example 11: Create and use an Animation "
---------------------------------------------------------------------------------------------------------
function load()
-- Set a lovely pink background color.
love.graphics.setBackgroundColor(246, 198, 222)
-- Load the source of the animation.
local img = love.graphics.newImage("images/a.png")
--local img = love.graphics.newImage("images/anim-boogie.png")
-- Create an animation with a frame size of 32x32 and
-- 0.1s delay betwen each frame.
anim = love.graphics.newAnimation(img, 320, 240, 0.1)
-- anim = love.graphics.newAnimation(img, 32, 32, 0.1)
end
function update(dt)
-- The animation must be updated so it
-- knows when to change frames.
anim:update(dt)
end
function draw()
-- Draw the animation the center of the screen.
love.graphics.draw(anim, 400, 400)
end
-----------------------------------------------------------------------------------
when I change the picture for default,the program will run normal.
The attachment PNG is 4800*720,one frame is 320*240,is there more key that I ignroe?
Love version is 0.50,OS version is XP SP3
Much thanks
The code like the "Example 11: Create and use an Animation "
---------------------------------------------------------------------------------------------------------
function load()
-- Set a lovely pink background color.
love.graphics.setBackgroundColor(246, 198, 222)
-- Load the source of the animation.
local img = love.graphics.newImage("images/a.png")
--local img = love.graphics.newImage("images/anim-boogie.png")
-- Create an animation with a frame size of 32x32 and
-- 0.1s delay betwen each frame.
anim = love.graphics.newAnimation(img, 320, 240, 0.1)
-- anim = love.graphics.newAnimation(img, 32, 32, 0.1)
end
function update(dt)
-- The animation must be updated so it
-- knows when to change frames.
anim:update(dt)
end
function draw()
-- Draw the animation the center of the screen.
love.graphics.draw(anim, 400, 400)
end
-----------------------------------------------------------------------------------
when I change the picture for default,the program will run normal.
The attachment PNG is 4800*720,one frame is 320*240,is there more key that I ignroe?
Love version is 0.50,OS version is XP SP3
Much thanks