Sprite (sprites.png) - originalfoo/Prison-Architect-API GitHub Wiki
This page relates to the
sprites.png-related setting.If you were looking for the
.spritebank-related setting, see Sprite.
##Overview
The Sprite setting is used to define what something will look like on the map (and also in menus, depending on the type of thing being defined).
##Syntax
This optional setting is almost always used in materials.txt and must be within a definition block. It can be used multiple times per definition block.
BEGIN Sprite
x <x> y <y> w <w> h <h>
RotateType <mode>
BEGIN Marker
x <mY> y <mX>
orientation.x <orX> orientation.y <orY>
Index <idx>
END
END
Where:
-
<x>and<y>are offset counts in32pxsteps from the top-left of the file(0, 0), which define the top-left of the south-facing part of your sprite(<x>, <y>)in yoursprites.png -
<w>and<h>are offset counts in32pxsteps from(<x>, <y>)that define the bottom-right of the south-facing part of your sprite(<x>+<w>, <y>+<h>)in yoursprites.png -
RotateTypeis optional, for more details seeRotateType -
Markerblock is optional, for more details seeMarker
##Example
BEGIN Sprite
x 0 y 0 w 4 h 3
RotateType 4
BEGIN Marker
x 2.140625 y 2.9375
orientation.x 0 orientation.y -1
Index 0
END
END
BEGIN Sprite
x 0 y 3 w 4 h 3
RotateType 4
BEGIN Marker
x 2.140625 y 2.9375
orientation.x 0 orientation.y -1
Index 0
END
END
##Notes
If you define sprites as shown above, but don't have a
sprites.pngfile in your mod, the game will useobjects.png(orpeople.pngforyvalues over63). This helps avoid the need to ever touch theobjects.spritebankfile should you wish to use sprites from the base game. When doing this thex,yco-ordinates are offset by1compared to positions defined in theobjects.spritebank.
Depending on the type of thing you are defining, there may be restrictions on which format of sprite definition you can use. For example, Room definitions can only use the .spritebank format.
For detailed information, see:
-
.spritebank- the old way of doing things -
sprites.png- the new way, which is better but still has some issues
And for detailed information on the sub-settings see:
-
Marker- positions of 'slots' on the object -
RotateType- defines how object rotation affects the sprite
You can get and set the currently active Sprite index for an object using the .SubType property.
You can get and set the current rotation of your object using the .Or property. This interacts with RotateType sub-setting to choose which part of the Sprite is being rendered.
You can access the slots on your object with the .Slot0..7 properties, their positions on screen are determined by an interaction of Marker and RotateType sub-settings.
##See Also