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 / [BUG?] Can't call SetSpriteAnimation() twice

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 13th Feb 2018 12:32 Edited at: 13th Feb 2018 12:44
If you call SetSpriteAnimation() on a sprite for a second time then AppGameKit will crash - no error message, just a hard ugly crash!

My initial thought was that the sprite was animating at the time that I tried to change the frame size, so I added a StopSprite() prior to the SetSpriteAnimation() but it made no difference. It crashes regardless of whether or not the sprite is currently animating.

Small test code:


You can avoid the crash by calling ClearSpriteAnimationFrames() prior to calling SetSpriteAnimation() but maybe that should be standard 'behind the scenes' functionality since not caling it produces such an ugly crash.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 13th Feb 2018 12:46 Edited at: 13th Feb 2018 12:48
I agree that AppGameKit should call ClearSpriteAnimationFrames(spr) automatically behind the scenes if necessary, rather than crashing.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Feb 2018 15:54
Quote: "ClearSpriteAnimationFrames(spr)"


What happens if you call that without having any animation set up though?
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 13th Feb 2018 16:29
Quote: "What happens if you call that without having any animation set up though?"

Nothing at all, so no harm in calling it before every SetSpriteAnimation()

Login to post a reply

Server time is: 2024-11-24 03:03:49
Your offset time is: 2024-11-24 03:03:49