https://ideone.com/fXJszY
Here is a link to a code viewer with my program in it.
This program overall is still kinda confusing to me. Specifically the activeFrame and currentFrame variables and the love.update(dt) function. Both of which I got from another source on animation in LOVE. But anyhow I'm trying to get the program in LOVE to alternate between the first animation frame and the second animation frame. Both sprites are currently positioned on top of each other when running the program.
Hello! I could use some help making a basic animation in LOVE.
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Hello! I could use some help making a basic animation in LOVE.
I can see what's causing you problems.
I suggest eliminating 'activeFrame' and stick with 'currentFrame'.
Then love.draw only has to contain
Think I've got that right.
Best
I suggest eliminating 'activeFrame' and stick with 'currentFrame'.
Then love.draw only has to contain
Code: Select all
im = animations[currentFrame]
love.graphics.draw(im, love.graphics:getWidth()/2,love.graphics:getHeight()/2, 0, 0.2,0.2 ,im:getWidth()/2,im:getHeight()/2)
Best
Re: Hello! I could use some help making a basic animation in LOVE.
That works thank you! But how would I separate both draw functions? I want to change the individual parameters for each image, for example their respective scaling. Is there a way to modify my existing two draw functions to allow for that? I tried replacing the animations[1] key with the variable im that you listed above but instead of drawing a single image it draws a duplicate for each image per frame.Ref wrote: ↑Wed Jun 13, 2018 10:48 pm I can see what's causing you problems.
I suggest eliminating 'activeFrame' and stick with 'currentFrame'.
Then love.draw only has to containThink I've got that right.Code: Select all
im = animations[currentFrame] love.graphics.draw(im, love.graphics:getWidth()/2,love.graphics:getHeight()/2, 0, 0.2,0.2 ,im:getWidth()/2,im:getHeight()/2)
Best
Re: Hello! I could use some help making a basic animation in LOVE.
Tables are what you want.
and then love.draw() contains:
Code: Select all
ans = {
{
image = love.graphics.newImage('somethingOne.png,
x=100,
y=100,
sx = 0.2,
sy = 0.2
},
{
image=love.graphics.newImage(somethingTwo.png',
x=300,
y=100,
sx=0.3,
sy=0.3
}
}
Code: Select all
love.graphics.draw(
ans[currentFrame].image,
ans[currentFrame].x,
ans[currentFrame].y,
0,
ans[currentFrame].sx,
ans[currentFrame].sy,
ans[currentFrame].image:getWidth()/2,
ans[currentFrame].image:getHeight()/2
)
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests