GLBasic forum

Main forum => GLBasic - en => Topic started by: ampos on 2010-Oct-17

Title: sprite2mem and animsprite
Post by: ampos on 2010-Oct-17
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
Title: Re: sprite2mem and animsprite
Post by: MrTAToad on 2010-Oct-17
With animated sprites, it will do the complete set of frames and not a single one.
Title: Re: sprite2mem and animsprite
Post by: ampos on 2010-Oct-17
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
Title: Re: sprite2mem and animsprite
Post by: MrTAToad on 2010-Oct-17
It would be - MEM2SPRITE is somewhat slow - its not suitable for use in a game loop.