Welcome!
As far as I know, you can't put gifs in LÖVE. Is it animated images that you want? You can use quads for that.
First you need to turn the gif into a spritesheet. In case you don't have tools for that, you can use
http://gif2sprite.com/ (Put it on PNG instead of JPG).
Click on View Sprite, right-click, and download the sprite.
Now in game you load the image
Code: Select all
function love.load()
image = love.graphics.newImage("spritesheet.png")
Next we need to make quads. With quads we can draw parts of images.
Code: Select all
quads = {}
local imgWidth, imgHeight = image:getWidth(), image:getHeight()
local spriteWidth = imgWidth / FRAMES
for i=0,FRAMES-1 do
table.insert(quads, love.graphics.newQuad(i * spriteWidth, 0, imgHeight, imgWidth, imgHeight)
end
Change FRAMES into the number of frames your animation has.
Now we need a timer
Code: Select all
timer = 0
end
function love.update(dt)
timer = timer + dt * SPEED
end
Change speed to make the animation go faster. Now we need to draw it
Code: Select all
function love.draw()
love.graphics.draw(image, quads[(math.floor(timer) % FRAMES) + 1], 100, 100)
end
Tada.
Or, you know, use a library like
anim8.