Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / PlaySprite BIG NASTY BUG

Author
Message
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Nov 2011 20:06
I have a big sprite 370 by 450, animated with 37 frames.

When I play more than 15 frames non-looping, the sprite does not play and stop, but loops with no apparent sense. When I play less than 15 frames all works fine, it plays once and stops.
BatVink
Moderator
20
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 13th Nov 2011 21:13
You need to post an example to back this up. Also bear in mind, your sprite is 9.6MB with all animation frames (512x512x37). You also haven't said what the source of the animation is - multiple images or an image atlas.

bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Nov 2011 22:10
its a sprite sheet, image atlas.

the filesize is a 1mb 2604 by 2580 image.

i will try to make an example.

its definitely a bug. for the moment i found a solution by putting a StopSprite command at the end when the animation plays.
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 13th Nov 2011 22:40 Edited at: 13th Nov 2011 22:41
Quote: "the filesize is a 1mb 2604 by 2580 image."

But doesn't AppGameKit 'pad' both width and height to the next power of 2? So it would then become a 4096 by 4096 image in memory.

bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Nov 2011 23:07
Don't know how AppGameKit works internally.

The game is for the ipad. I am testing on Windows for now.
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 13th Nov 2011 23:44
I'm not sure if it's done on windows but it might be done for ipads. Here's the padding info.

bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 14th Nov 2011 09:03
I am enclosing a code sample that demonstrates the bug.

Apparently the culprit is the SetSpriteFrame line.


Attachments

Login to view attachments
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 14th Nov 2011 23:20
I see what you're saying. It's looping but shouldn't, atleast according to how you set the parameters for agk::playsprite(). Well, atleast you have a solution.

bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 14th Nov 2011 23:34
Yes it shouldn't loop, but after it plays, it ERRATICALLY starts playing back other frames from the very start (frames 1, 2, 3 etc). The problem happens on this command: agk::SetSpriteFrame(testsprite, 1);
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 15th Nov 2011 01:48
The use of agk::SetSpriteFrame(testsprite, 1) is throwing off the animation routine since it thinks it hasn't reached 37 yet (it checks just before displaying frame 38 if it should stop, so changing it on 37 deprives it of this check).
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 15th Nov 2011 11:20
frame 38 does not exist since the spritesheet is 37 frames long.

I want to display frame 1 after frame37 (last frame) has finished.
so what do you suggest?
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 15th Nov 2011 12:49
bjadams... Not sure if this helps, but what I tend to do is just let it loop... And then just stop it yourself when it reaches the last frame... For example:



Thats always worked for me anyway...
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 15th Nov 2011 14:32
I am using STOPFRAME to get around the problem for how.
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 15th Nov 2011 14:50 Edited at: 15th Nov 2011 14:52
Yeah, I thought that was what you were doing... I think what Paul is saying is that the loop hasn't actually finished when you are chainging it to frame 1, thus the loop never had the chance to stop.

What happens if you change this:



To this:



Would that work?
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 15th Nov 2011 21:13
I missed the GetSpritePlaying command because its not listed under Sprite animation in the docs.

I think this a a more elegant solution.

However I think there's still a but there, which should be taken care of.

Login to post a reply

Server time is: 2024-03-28 21:55:04
Your offset time is: 2024-03-28 21:55:04