Difference between revisions of "NML:Spriteset"

From GRFSpecs
Jump to navigationJump to search
(Undo revision 2630 by Planetmaker (Talk) but keep link fix)
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
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.
 
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, graphics_file) {
+
spriteset (<spriteset-name>[, <image-file>]) {
 
[[NML:Realsprites|list of realsprites]]
 
[[NML:Realsprites|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 (see [[NML:Realsprites|Real sprites]]).
   
 
Each sprite may be prefixed with a label, see [[NML:Spritelayout#Sprite| sprite layouts]] for more info. Example:
 
Each sprite may be prefixed with a label, see [[NML:Spritelayout#Sprite| sprite layouts]] for more info. Example:
Line 19: Line 23:
 
* For vehicles, the same as above is possible. However, to facilitate the common case of having multiple loading stages, you can also define [[NML:Spritegroup|sprite groups]], see below. These sprite groups are then used in place of a single sprite set.
 
* For vehicles, the same as above is possible. However, to facilitate the common case of having multiple loading stages, you can also define [[NML:Spritegroup|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 [[NML:Spritelayout|sprite layout]] is used, directly referring to sprite sets is not possible here
 
* 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 [[NML:Spritelayout|sprite layout]] is used, directly referring to sprite sets is not possible here
* Features not mmentioned here have no use for sprite sets, as such they are not supported by NML.
+
* Features not mentioned here have no use for sprite sets, as such they are not supported by NML.

Latest revision as of 15:04, 1 November 2014

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 (see Real sprites).

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.