Thanks Rick, glad you like it! Never done one before so wasn't sure how it would go, as I just winged it ( the recording) so to speak.
Phaelax, Yeah I was getting a lot higher frame rates when not recording also
My image, btw is simply a blank 1024x1024 image for the animated frames, and a 32x32 image for the first test. I'm not actually using it in this, but added the code in to show how to do it. It would work, if I were to add some actual art though
You must have a faster video card than mine though, I was getting 1000+ odd frames at best.
I've made a very rubbish image to use with the code if people want to try it, just to show it is using an image, and a different frame for each (not that I have altered the frames image)
For the single image I just use a 32x32 of a single frame from it.
Here is the code also, to save you having to pause the video and type it.
rem
rem AGK Application
rem
rem A Wizard Did It!
setvirtualresolution(800,600)
setsyncrate(0,0)
`setvsync(1)
loadtime_start#=timer()
gosub option1
`gosub option2
`gosub option3
loadtimeend#=timer()-loadtime_start#
do
angle#=angle#+.1
for n=1 to spritecount
setspriteangle(n,angle#)
next n
gosub debug
Sync()
loop
option1:
for x=1 to 32
for y=1 to 32
spritecount=spritecount+1
loadimage(spritecount,"image2.png")
createsprite(spritecount,spritecount)
setspritesize(spritecount,10,10)
setspritecolor(spritecount,random(1,255),random(1,255),random(1,255),255)
setspriteposition(spritecount,200+(x*11),170+(y*11))
next y
next x
return
option2:
loadimage(1,"image.png")
for x=1 to 32
for y=1 to 32
spritecount=spritecount+1
createsprite(spritecount,1)
setspritesize(spritecount,10,10)
setspriteanimation(spritecount,32,32,1024)
setspriteframe(spritecount,spritecount)
setspritecolor(spritecount,random(1,255),random(1,255),random(1,255),255)
setspriteposition(spritecount,200+(x*11),170+(y*11))
next y
next x
return
option3:
loadimage(1,"image.png")
dummy=createsprite(1)
for x=1 to 32
for y=1 to 32
spritecount=spritecount+1
clonesprite(spritecount,dummy)
setspritesize(spritecount,10,10)
setspriteanimation(spritecount,32,32,1024)
setspriteframe(spritecount,spritecount)
setspritecolor(spritecount,random(1,255),random(1,255),random(1,255),255)
setspriteposition(spritecount,200+(x*11),170+(y*11))
setspritetransparency(spritecount,0)
next y
next x
deletesprite(dummy)
return
debug:
fps=screenfps()
fpscounted=fpscounted+1
totalframecount=totalframecount+fps
averageFPS#=totalframecount/fpscounted
spritecount=GetManagedSpriteCount()
drawcall=GetManagedSpriteDrawCalls()
drawcount=GetManagedSpriteDrawnCount()
drawsetuptime#=GetDrawingSetupTime()
drawtimecount#=drawtimecount#+drawsetuptime#
averagedrawsetuptime#=drawtimecount#/fpscounted
drawtime#=GetDrawingTime()
drawtime2count#=drawtime2count#+drawtime#
averagedrawtime#=drawtime2count#/fpscounted
setprintsize(18)
`print("FPS "+str(screenfps()))
print("Average FPS "+str(floor(averageFPS#)))
print("Sprites "+str(spritecount))
print("Draw Calls "+str(drawcall))
print("Sprites Onscreen "+str(drawcount))
`print("Draw Setup Time "+str(drawsetuptime#))
print("Average Draw Setup Time "+str(averagedrawsetuptime#))
`print("Draw Time "+str(drawtime#))
print("Average Draw Time "+str(averagedrawtime#))
print("Initial Loading Time "+str(loadtimeend#)+" secs")
return