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.
Flickering Errors With Quad Animation
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 2
- Joined: Fri Dec 07, 2012 5:08 am
Flickering Errors With Quad Animation
- Attachments
-
- test.love
- The main file for the game.
- (207.95 KiB) Downloaded 106 times
Re: Flickering Errors With Quad Animation
I looked at the update function, and noticed @curTime wasn't being reset, so I fixed that:
(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...
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!
Code: Select all
if @curTime <= 0
@incFramePoint!
@curFrame = @frames[@curFramePoint]
@curTime = @curTime + @delay
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)
Code: Select all
for y = 0, @image\getHeight! - 1, split_height
for x = 0, @image\getWidth! - 1, split_width
-
- Prole
- Posts: 2
- Joined: Fri Dec 07, 2012 5:08 am
Re: Flickering Errors With Quad Animation
Everything works fine now, thanks for all your help.
Who is online
Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Google [Bot] and 6 guests