Page 1 of 1

Flickering Errors With Quad Animation

Posted: Fri Dec 07, 2012 5:20 am
by FeatherAndrew
I'm trying to create my own animation system in LOVE, because I can't get AnAL to work, but my implementation has a lot of flickering. Any idea what could be wrong? (The Lua scripts are auto generated. The code was written in http://moonscript.org/ and compiled to Lua.)

Since I can't upload the moon scripts separately I'll just include them in the love file.

Re: Flickering Errors With Quad Animation

Posted: Fri Dec 07, 2012 9:15 am
by Santos
I looked at the update function, and noticed @curTime wasn't being reset, so I fixed that:

Code: Select all

if @curTime <= 0
	@incFramePoint!
	@curFrame = @frames[@curFramePoint]
	@curTime = @curTime + @delay
(The reason why I wrote @curTime = @curTime + @delay instead of @curTime = @delay is to have more accurate timing, as @curTime could be any number less than 0, so the next update will be the delay time, minus any time which has already gone past.)

I also printed out the x and y values in the for loops...

Code: Select all

for y = 0, @image\getHeight!, split_height
	for x = 0, @image\getWidth!, split_width
		print(x, y)
And there were more frames than there should be, and I suspected it might be an "off by one" error, so I tried this, and now everything seems to work! :awesome:

Code: Select all

for y = 0, @image\getHeight! - 1, split_height
	for x = 0, @image\getWidth! - 1, split_width

Re: Flickering Errors With Quad Animation

Posted: Fri Dec 07, 2012 4:46 pm
by FeatherAndrew
Everything works fine now, thanks for all your help.