You must be logged in to do that.

GetSprite

GetSprite
int GetSprite()

Documentation

Returns the first sprite index found without an assigned image handle. You can have up to 256 sprites simultaneously. You should immediately set an image for the sprite, or else the sprite handle will be reused by a later GetSprite() call. Returns -1 if a free index cannot be found.

Note: In the current build, all sprite data must be manually cleared from an index. This means all sprite variables should be assigned a value, or else you risk having unwanted sideeffects

Example Usage

void SpawnRainDrop()
{
	int i = GetSprite();
	if (i == -1) return;

	sprite.x[i] = Random(0, ImageWidth(screen));
	sprite.y[i] = -Random(0, ImageHeight(screen)); // Negative coords.
	sprite.sc[i] = 0; // 0 = map coordinates, 1 = screen coordinates
	sprite.image[i] = image_raindrop; // This means sprite is now on.
	sprite.lucent[i] = 0; // Opaque.
	sprite.addsub[i] = 0; // 0 = normal blit, -1 = subtractive blit, +1 = additive blit
	sprite.alphamap[i] = 0; // No alpha map here.
}
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Doc Nav

Your docs
View All Docs

If you log in, you can edit the documentation, or create your own documents and tutorials!

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.