NML:Spriteset

From GRFSpecs
Revision as of 21:21, 3 March 2012 by Hirundo (talk | contribs) (Document parameters better)
Jump to navigationJump to search
Block Syntax

A spriteset associates a name with a number piece of an existing image file and describes the offsets with respect to some origin the graphics will be painted within the game. Different features and situations require that a single set has a certain amount of actual sprites associated. E.g. a vehicle usually requires eight sprites in order to provide on view for each of the eight possible ingame orientations of a vehicle.

spriteset (<spriteset-name>[, <image-file>]) {
	list of realsprites
	...
}

Parameter <spriteset-name> specifies the name of this spriteset. This name is used to refer to the spriteset later on.

Parameter two <image-file> (optional) is a literal (quoted) string that specifies the default file where the sprites are located. This may be overridden per-sprite.

Each sprite may be prefixed with a label, see sprite layouts for more info. Example:

 	some_label: [... real sprite ...]

How to use a sprite set depends on the feature:

  • For canals, cargos, airports (not tiles!) and railtypes, you can refer to sprite sets directly from the graphics block, or use intermediate (random)switches to make a descision.
  • For vehicles, the same as above is possible. However, to facilitate the common case of having multiple loading stages, you can also define sprite groups, see below. These sprite groups are then used in place of a single sprite set.
  • Stations, houses, industry tiles, objects and airport tiles all define the look of a tile. This often requires more than one sprite, for example a concrete ground sprite with a building sprite on top of it. To combine and arrange these sprites a sprite layout is used, directly referring to sprite sets is not possible here
  • Features not mentioned here have no use for sprite sets, as such they are not supported by NML.