Page 1 of 1

how can i draw a sprite

Posted: Mon May 10, 2010 9:45 am
by TonyDwr
I create a spritepatch, and try to draw it , but only show the first picture of the sprite, i want to show the sprite one frame by another frame..
how can i draw a sprite which has a few pictures? I have been tried to used a gif picture that fix all the pictures in,and draw it but there is no effect, and tried to use a picture that your demo used named "planetfont.png" but has no effect too. Can any body can tell me how to do this? I want to draw a consecutive animation(or I call it a sprite tha has bath consecutive pictures).
my english is not good..so.... who can understand and tell me how to use the spritepath. my code:
---------------------------------------------------------------------------------------C o d e----------------------------------------------------------------------------------
function love.load()
boss_one_1 = love.graphics.newImage("planetfont.png")//this picture I want to draw has batch consecutive pictures
boss_one = love.graphics.newSpriteBatch(boss_one_1, 39)
boss_one:add(300, 200, 0, 1, 1, 0, 0)
end

function love.update(dt)
--[[
do sth.
]]
end

function love.draw()

love.graphics.draw(images.bg, 0, 0, 0, 1, 1, 0, 0)

love.graphics.draw(boss_one, 80, 50, 0, 1, 1, 0, 0)//only show the first frame of this sprite

end
--------------------------------------------------------------------------------------

Re: how can i draw a sprite

Posted: Mon May 10, 2010 10:02 am
by Robin
Well, it's difficult to tell what you want. Do you want to get an animation from an image? You could use AnAL.

Re: how can i draw a sprite

Posted: Tue May 11, 2010 2:45 am
by TonyDwr
Yes, thank you very much. my english is not very good. so... thanks very much.