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 / Creating Animated Sprites from Atlas Images

Author
Message
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 18th Mar 2015 21:04
Two questions for those in the know...

1. If you want to make animated sprites via atlas images (and associated subimages text file) do you use the AddSpriteAnimationFrame to create the sprite frames. Is that the best way?

2. Can you then delete these subimages (is this even possible?) and just maintain the atlas image in memory or do the subimages need to remain loaded?

Thanks

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th Mar 2015 11:44
You don't need to extract the subimages at all.

Just use the SetSpriteAimation command to directly associate your animation frames with your atlas texture.

AGK V2 user - Tier 1 & 2
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 20th Mar 2015 17:59
I use the technique you mention for the tile sprites in my maps as they are all the same size, but how does this work if your atlas image is made up of sprites of varying sizes? I'm wanting to pack lots of different sized frames for various sprites onto one image (as I hear this is best for performance) but the SetSpriteAnimation expects the image to be made up of consistently sized images to extract correctly doesn't it?

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 20th Mar 2015 19:12
Yes it does, which is why I would consider this the exception to the rule.
I would put all of my animated sprites on one texture and everything else on another.

AGK V2 user - Tier 1 & 2
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 20th Mar 2015 19:31
In the manual under the AddSpriteAnimationFrame command it says...
"Alternatively if you have all your animation frames on a single image you can use the faster SetSpriteAnimation that avoids image changes during rendering by modifying the UV coordinates to change frame instead."

If you use the AddSpriteAnimationFrame to get all the frames of a sprite from a single image, does this maintain the performance because effectively the animation frame changes will still occur via UV changes rather than accessing separate image files?

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)
DavidAGK
AGK Developer
10
Years of Service
User Offline
Joined: 1st Jan 2014
Location:
Posted: 20th Mar 2015 19:57
Weird thing is this must be needed all the time yet the manual skirts around it. It talks about atlas images and the SetSpriteAnimation but never covers (as far as my searching skills go) using atlas images for animated sprites?! And the Hands On AppGameKit Basic book, skips it too!

Just don't want to code a new sprite loading function that performs badly.

Using Tier 1 AppGameKit V2
Started coding with AMOS (Thanks Francois Lionet)

Login to post a reply

Server time is: 2024-11-25 18:33:38
Your offset time is: 2024-11-25 18:33:38