Skip to content

Common Sprite Properties

Raluca D. Gaina edited this page Feb 12, 2018 · 1 revision

All sprites in VGDL have some common properties. These properties can be altered to change the behavior or the look of the sprite. In the rest of the document we divide the properties according to its usage (Note: not all properties work with all Sprite Types, for example: speed=1 doesn't affect sprites of type Immovable).

List of Common Sprite Properties:

Graphics:

  • shrinkfactor: Scale the sprite size. It can take any float value, for example: shrinkfactor=0.5 decrease the sprite size into half, while shrinkfactor=2 increase the sprite size into double (Default value is 1).
  • invisble: Render the sprite as invisible. It can take either True or False (Default value is True).
  • hidden: Does not pass the sprite to the agents in state observations. It can take either True or False (Default value is False).
  • img: The image file name which represent the sprite. It can take any string value that correspond to a certain image file found in sprites folder (Default is null).
  • color: If img property is null, VGDL will represent the sprite as a colored square. It can take any of the color values (Default is pick random color for each sprite).

Existence:

  • singleton: Only one instance of the sprite can exist in the game. It can take either True or False (Default value is False).

Update:

  • cooldown: Slow down the update rate of the sprite. It can take any integer value (Default is 1 which means the sprite is updated every time tick).
  • speed: The size of the step the sprite is moving with it in Blocks. It can take any float value (Default is 0 which means the sprite doesn't move).

Orientation:

  • orientation: The direction the object is pointing towards. It can take any direction value (Default value is NONE).
  • rotateInPlace: If the sprite can rotate without changing its position. It can take either True or False (Default value is True).

Examples:

bullet      > Missile speed=0.5 orientation=DOWN img=bullet

Define bullet sprite of type Missile which moves down with 0.5 block every time tick and is rendered as sprites\bullet.png file.

cannon      > Passive invisible=True

Define cannon sprite of type Passive which is not rendered on screen.

randomEnemy > RandomNPC cooldown=5 img=bee

Define randomEnemy sprite of type RandomNPC which updates itself every 5 time ticks and is rendered as sprites\bee.png file.

Table of Contents:

Clone this wiki locally