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 / There is a problem about PlaySprite(int iD, float Fps, int iLoop).

Author
Message
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 09:00 Edited at: 27th Feb 2012 09:02
PlaySprite(10, 0);

Sometime, it will take a mistake. the animation just stay the frame 1, and can't play. I am very puzzled.
Can anyone give a hand ? I don't know where is wrong. I exam my program many times ,but I can't find the reason. maybe it's a bug of AppGameKit, hope someone can give a hand.

This kind of bug don't show every time. so It's very difficult to find the reason.

The Miracrea Games
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th Feb 2012 09:56
I haven't experienced any issues as yet... Are you checking to ensure its not already playing?

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 10:42
I just now made a test about GetSpritePlaying(). it's useless for this problem.
I guess SetSpriteActive() may have relation with the problem. but I'm not sure about it.
Hope to receive more suggestions.

The Miracrea Games
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 11:09
PlaySprite(spriteID,fps)
PlaySprite(10, 0)

You are telling AppGameKit to play sprite 10 at zero frames per second. Try this:
PlaySprite(10,30,1) the 1 will loop the animation (change to zero if you don't want it to loop)

kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 27th Feb 2012 11:36
I will add that 30 might be a little (or more than a little) frames too much.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 11:51
Quote: "I will add that 30 might be a little (or more than a little) frames too much."

Well doesn't that depend on the type of animation? I have sprite sheets that I run at that speed

kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 27th Feb 2012 11:53 Edited at: 27th Feb 2012 11:53
Depends on what do you need I guess

I have a background of a stadium, where crowd is moving. I used 10 FPS or even lower, so they're not jumpy.

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 11:54
@baxslash, the problem sometimes happens and sometimes don't happen. and I can't find the reason.
Sometimes it is just well. but for a very few situation, the animation just stay frame 1,and stop the animation.

The Miracrea Games
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 27th Feb 2012 11:56
Try



baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 11:56
Any chance you could provide an example when it doesn't work? Just a simple one maybe if you can narrow it down?

halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 11:59
agk:laySprite( m_iID, fFps, iLoop );

I just call the function, only one line.

The Miracrea Games
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 11:59
Sometimes, I guess it's a bug of AGK.

The Miracrea Games
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th Feb 2012 12:05
Depending on how you are initiating PlaySprite, you must ensure you are not already playing the animation (as per my first post). You mention that you are using PlaySprite on its own (only one line), this is likely your problem. Post your code and perhaps we can take a look.
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 27th Feb 2012 12:10


You maybe can't understand my code. Because I use C++, and enclose a class CSprite.

The Miracrea Games
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 27th Feb 2012 13:38
I guess you have a code to StopSprite somewhere, right?

Just analize your code, step by step what's being done. It might be a simple programming failure.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 27th Feb 2012 13:56
agk:laySprite( m_iID, fFps, iLoop );

I could be wrong but is that a yellow gremlin in your code halley ?

I can't see the problem but then maybe it's not in the code here. I would write a small separate, self contained program that shows the problem and post it on the bug board.

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 27th Feb 2012 18:40
Since you are not looping, are you using SetFrame() to reset the sprite back to beginning of the animation, otherwise it will forever be at the end. Also since you are using the sprite class are you calling Update() along with Draw(), or using a sprite manager?
halley
13
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 28th Feb 2012 10:08
@Paul, I called Stop(), but in the front of Play(10, 0).
I called SetActive() when user tap pause button. I guess the problem has relation with this function.

I didn't call SetFrame() , and the animation just stay frame 1,and can't play. I mean it didn't play any times.

The Miracrea Games
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th Feb 2012 15:17
Draw() won't update the animation, are you calling Update() on the sprite?

Login to post a reply

Server time is: 2024-11-23 05:15:45
Your offset time is: 2024-11-23 05:15:45