PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Sprite Clones

Well, I d like to know how to delete sprite clones.
Something like that doesnt work:
Code:

bullet$ = loadSprite(Apppath$ + "bullet.bmp", RGB(0, 0, 0), 1, 0, &BulletProc;);
bulletClone$=CloneSprite(bullet$);
Delsprite(bulletClone$);


And one more question:
How to store some structure in the Sprite data field?
Hi,

There was a bug in the DelSprite() which I fixed.

To copy structures in the data field of a sprite you have to do it like this:

Code:
struct(s$, "a", "b", "c");
SetSpriteData(Sprite$, s$);


Later to retrieve the struct:

Code:
i$ = SpriteData(Sprite$);
struct(s$, "a", "b", "c");
&s;$ = i$; // Change struct pointer to the value of i$.


At the end, make sure to free the structure from the Sprite data.

Code:
free(SpriteData(Sprite$));


NB: I have fixed a few things today, this code will only work properly in the newest version, which will be released sometime today.