LoadAnimImage

BlitzMax Forums/BlitzMax Beginners Area/LoadAnimImage

Ant(Posted 2006) [#1]
Hi after using LoadAnimImage, I've asserted that the image loads which it does, but when I look in image - frames in the debugger, all the frames are Null.....anyone any ideas how this would happen if the image is loading?
thanks


tonyg(Posted 2006) [#2]
You have to use (e.g. drawimage) the frame to create the TImageframe object. It is the pointer to this object that you see in the debug window.


Ant(Posted 2006) [#3]
hmm.any time I try and change the frame, it says 'attempt to index array element beyond array length'.....yet it seems to loads the image and frames alright - aside from asserting the image (which I am doing) is there any way to check how many frames its actually loaded?
Thanks


Moogles(Posted 2006) [#4]
dont you specify the amount of frames with loadanimimage?


tonyg(Posted 2006) [#5]
Have you got any code to share?
Anyway...
image:TImage=loadanimimage(etc etc)
print len(image.frames)+1



Ant(Posted 2006) [#6]
I did specify how many frames...unfortunately the code is scattered and large so I cant share...thanks Tonyg I'll see what the len code spits out.


Ant(Posted 2006) [#7]
Ok...just to check something obvious...in the cell_count field if I specify 9 frames, then as its an array they are stored 0...8?

thanks


TomToad(Posted 2006) [#8]
Yes, unless the first frame parameter has something other than 0 in it.
Image:TImage = LoadAnimImage("Image.png",32,32,0,9)

will have frames 0..8
Image:TImage = LoadAnimImage("Image.png",32,32,1,9)

will have frames 0..7


tonyg(Posted 2006) [#9]
Don't forget that will only reflect what you put in. It's when you try to use a frame there'll be a problem.
You could check the imagewidth/imagelength divided by len(image.frames) to make sure it returns you frame size.


Ant(Posted 2006) [#10]
Ok guys sorted. There was a bug elsewhere in my code which loaded an image without animation frames, when I was convinced it was loading an image with frames. Dahh! Thanks for all the help.