int GetSprite()
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
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. }
There are no talkbacks on this documentation page yet. Post the first?
Doc Nav |
Your docs |