Page 2 of 2

Re: Is There any way to make an Animation without Quads?

Posted: Wed Mar 28, 2018 3:43 pm
by pgimeno
You'll need to learn a bit more Lua, in particular how to use variables and conditions, to make stuff change over time.

Re: Is There any way to make an Animation without Quads?

Posted: Fri Mar 30, 2018 3:01 am
by PGUp
JacKobOriginal wrote: Wed Mar 28, 2018 2:21 pm
zorg wrote: Wed Mar 28, 2018 2:49 am You hide things by not showing them, i.e. don't draw them during frames you want to not show those sprites.
And how do I do that in love.update(dt)? I tried putting love.graphics.draw in it but nothing happened when I pressed the button I assigned the animation in.
Making it as simple as possible for you

Code: Select all

function love.load()
Animation1 = {}
Animation1 [1] = love.graphics.newImage("walk1.png")
Animation1[2] = love.graphics.newImage("walk2.png")
Animation1[3] = love.graphics.newImage("walk3.png")

Animation2 = {}
Animation2 [1] = love.graphics.newImage("jump1.png")
Animation2[2] = love.graphics.newImage("jump2.png")
Animation2[3] = love.graphics.newImage("jump3.png")
frame = 1
Pose = "walk"
end

function love.update()
frame = frame + 1
if frame > 3 then
frame = 1
end
If playeriswalking() then
Pose = "walk"
end
If playerisjumping() then
Pose = "jump"
end
end

function love.draw()
If Pose == "walk" then
love.graphics.draw(animation1[frame])
end
If Pose == "jump" then
love.graphics.draw(animation2[frame])
end
end