sprite2mem and animsprite

Previous topic - Next topic

ampos

Can I sent a frame of a animated sprite to mem?

if I do a matrix to store diferent "mem" and use it to "mem2sprite"? I mean:

Code (glbasic) Select
dim m[24*24 size][10 frames]
mem2sprite m[][frame],spritenumber
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

With animated sprites, it will do the complete set of frames and not a single one.

ampos

In my game, when snowing there is around 640 sprites (5x5).

On iphone4 runs at 60fps, on 3GS at 30-40 and on 3G around 10-30 (yes, very irregular)

So I try to create a 480x320 sprite and dim bk[480x320].

Code (glbasic) Select
for each drop
   bk[y*480+x]=0xffffffff
next
mem2sprite bk[],spr,480,320


This full loop has to be called each frame, and for my surprise, it is A LOT SLOWER than

Code (glbasic) Select
for each drop
   drawsprite spr,x,y
next


havent noticed any difference using alphamode -1 or alphamode 0
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

MrTAToad

It would be - MEM2SPRITE is somewhat slow - its not suitable for use in a game loop.