Sprite overview
Root / Documentation / [.]
Created:
# Summary
Each screen allows a maximum of 100 sprites to be in use. These sprites have a variety of potential operations - they can be created in various sizes, moved across the screen, and placed on different layers. Sprites can also use the built-in sprite collision and sprite animation functions, as well as the sprite variables. Sprites 0-31 support some additional operations, like rotation and scaling.
# Interface
## Commands
|sbs:page/docs-ptc-sppage{`SPPAGE`}|Sets the current screen to modify sprites of|
|sbs:page/docs-ptc-spclr{`SPCLR`}|Clears one sprite or all sprites on one screen.|
|sbs:page/docs-ptc-spset{`SPSET`}|Creates a new sprite.|
|sbs:page/docs-ptc-spofs{`SPOFS`}|Moves a sprite.|
|sbs:page/docs-ptc-sphome{`SPHOME`}|Sets the origin point of a sprite|
|sbs:page/docs-ptc-spchr{`SPCHR`}|Changes the appearance of a sprite|
|sbs:page/docs-ptc-spanim{`SPANIM`}|Animates a sprite.|
|sbs:page/docs-ptc-spangle{`SPANGLE`}|Rotates a sprite|
|sbs:page/docs-ptc-spscale{`SPSCALE`}|Scales a sprite|
|sbs:page/docs-ptc-spread{`SPREAD`}|Reads properties from a sprite|
|sbs:page/docs-ptc-spsetv{`SPSETV`}|Stores a value to a sprite variable.|
|sbs:page/docs-ptc-spcol{`SPCOL`}|Sets properties of a sprite for collision.|
|sbs:page/docs-ptc-spcolvec{`SPCOLVEC`}|Sets a vector to be used during sprite collision.|
## Functions
|sbs:page/docs-ptc-spgetv{`SPGETV`}|Gets the value from a sprite variable.|
|sbs:page/docs-ptc-spchk{`SPCHK`}|Checks if the sprite is being animated in various ways.|
|sbs:page/docs-ptc-sphit{`SPHIT`}|Checks if the sprite has hit any other sprite.|
|sbs:page/docs-ptc-sphitsp{`SPHITSP`}|Checks if the sprite has hit some specific sprite.|
|sbs:page/docs-ptc-sphitrc{`SPHITRC`}|Checks if the sprite has hit a rectangular region.|
## System Variables
\h[Under construction]{
|`SPHITNO`|Stores the id of the sprite that was hit `SPHIT`|
|`SPHITX`|Stores the x-coordinate of the sprite collision|
|`SPHITY`|Stores the y-coordinate of the sprite collision|
|`SPHITT`|Stores a value between 0 and 1 related to the distance between sprites|
Note: `SPHITX` and `SPHITY` depend the `SPOFS` coordinates of the sprite. `SPHITY` appears to depend on `SPHITX`. `SPHITT` depends on all of the above.
TODO: This needs a better explanation.
}
## Resources
|`SPU0`-`SPU7`|Resources for upper screen sprite characters|
|`SPS0L`-`SPS1L`|Resources for lower screen sprite characters|
|`COL1U`|Upper screen sprite palettes|
|`COL1L`|Lower screen sprite palettes|
# Additional Information
Sprites are formed from 8x8 16-color characters, similar to the background layers. The size of a sprite determines how many characters are used. Characters are placed in the sprite going from left to right, then top to bottom. The color palette can only be specified for an entire sprite, not individual characters like a background.
For example, here are some sprite sizes and character layouts:
```
16x16 32x16 16x32
01 0123 01
23 4567 23
45
67
```
No posts yet (will you be the first?)