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] with SetSpriteAnimation()

Author
Message
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 4th Jun 2018 14:09
if you have say SetSpriteAnimation(id,40,40,10) and you've loaded an image that has a native size of 40x200, there will be no sprite displayed. no error, no backtalk from the compiler, no crash on the game itself, nothing to indicate there is a problem with your image size, only a very silent lack of a sprite, or as I discovered, lack of about 50 sprites as it was in a loop. Just thought someone would like to know...
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2018 15:33 Edited at: 4th Jun 2018 15:38
Im sorry but thats not true

Ive found - If you set a number of frames that cant actually occur due to the total frame number being higher than possible, then agk animates the frames that it can show then returns back to the first frame without attempting to display those that don't exist. Thats how it works in one of my apps anyway. It displays just those that are logical (Those actually in the image) then starts again from zero again.

That's tested on windows and android so im unsure of why you have nothing displayed?? (Are you calling PlaySprite() anywhere?? - and how many frames are you attempting to play in that?)
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 4th Jun 2018 20:31 Edited at: 4th Jun 2018 20:34
I'm sorry, I was really tired last night, when it's coupled with PlaySprite(id,0,0,10,10) then you get the silent failure, by attempting to display a frame that is off the reservation. But by changing the SetSpriteAnimation to represent the correct # of frames based on actual size of the image, that fixes it. The point being that there's no error or warning when you declare SetSpriteAnimation on an image that isn't big enough to load the specified frame with PlaySprite
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 4th Jun 2018 22:54
do you have SetErrorMode(2) called at the start of your app?
life's one big game
spec= 4ghz, 16gb ram, AMD R9 2700 gpu
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 4th Jun 2018 23:37 Edited at: 4th Jun 2018 23:39
Even with SetErrorMode(2) on at the beggining of the program the spriteanimation function doesnt always catch the illegal number of frames. He is right that there is a bug

Depending on the image dimensions you may get


But with some images it silently passes the setting of a number of images that cant exist as the image isnt big enough then attempts to play them. This results in some legitimate frames being played followed by a last frame that shows very little (UV coords outside 1.0,1.0).

So the OP is correct... the checking of a valid number of frames isnt quite what it should be but it does depend on image dimensions it would seem.
Zen Jones
7
Years of Service
User Offline
Joined: 1st Jul 2017
Location:
Posted: 5th Jun 2018 08:51
yes, I do have SetErrorMode(2) called at the start.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Jun 2018 15:33
Thanks, fixed for the next version, it will now always report an error if the image is not big enough for the specified number of frames

Login to post a reply

Server time is: 2024-11-23 20:23:09
Your offset time is: 2024-11-23 20:23:09