Is There any way to make an Animation without Quads?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
pgimeno
Party member
Posts: 3674
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
PGUp
Party member
Posts: 105
Joined: Fri Apr 21, 2017 9:17 am

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

Post 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
-
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest