Flickering Errors With Quad Animation

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.
Post Reply
FeatherAndrew
Prole
Posts: 2
Joined: Fri Dec 07, 2012 5:08 am

Flickering Errors With Quad Animation

Post 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.
Attachments
test.love
The main file for the game.
(207.95 KiB) Downloaded 106 times
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Flickering Errors With Quad Animation

Post 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
FeatherAndrew
Prole
Posts: 2
Joined: Fri Dec 07, 2012 5:08 am

Re: Flickering Errors With Quad Animation

Post by FeatherAndrew »

Everything works fine now, thanks for all your help.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests