Diddy - animation strip within an atlas

Monkey Forums/Monkey Programming/Diddy - animation strip within an atlas

Raz(Posted 2014) [#1]
I'm really sorry, this is probably a really dumb question but I can't quite wrap my head around this.

I'm making a sprite atlas using Texture Packer, within this atlas is an animation strip called coin-animation (64x16) containing 4 frames, 16x16 each. I want to "find" this animation and load the 4 frames within it.

Currently I am storing all images as GameImage's, as per the Diddy sprite atlas example.

	Global gfxCoin:GameImage
	
	Function Init:Void()
		Local tmpImage:GameImage = diddyGame.images.Find("coin-animation")
		' SOMETHING HERE TO PUT tmpImage INTO gfxCoin as 4 frames of 16x16
	End


I know it's probably really obvious, but I can't figure it out!

ta :)


Paul - Taiphoz(Posted 2014) [#2]
gfxCoin = diddyGame.images.FindSet("coin-animation",16,16,4)


The strip needs to be exactly that tho a strip, as FindSet does not like strips that cover more than one row.

Check the diddy source tho to be sure I have those params in the right order I didn't check just posted off the top of y head.


Raz(Posted 2014) [#3]
Cheers Paul, just had a look through the examples.

I did notice the following:

zombieImage = diddyGame.images.FindSet("idle_left1", 128, 128, 15)


relates to this

<TextureAtlas imagePath="zombie_0.png">
    <SubTexture name="idle_left1" x="1" y="1" width="128" height="128"/>


The size for idle_left1 as specified in the generated XML file is 128 by 128 (size of a single frame). Yet the size of my coin strip is specified as 64x16 (size of the whole strip), so it seems like it's different to me?

I hope that makes sense to someone!


Raz(Posted 2014) [#4]
It seems like the original XML specified size is ignored once you specify the frame count and size through Monkey, so that's fine with me :) Cheers Paul


Paul - Taiphoz(Posted 2014) [#5]
Your welcome mate, happy to be of some help to some one, looking forward to seeing what your making :)