CreateSpriteState
From OxeyeWiki
video.createSpriteState(animationName, gfxPackageName) | ||
This method creates a new sprite animation state and returns its ID value. The sprite animation is located in a sprite package, which in turn is loaded if it's not already loaded. The path to the package is relative to Daisymoon's source folder. | ||
Parameter | Expected Type | Description |
animationName | A string | The name of the animation as it is written in the gfx package. The name is case sensitive. |
gfxPackageName | A string | The name of the gfx package, relative to the source folder. The name is case sensitive on Mac OS X |
Returns | ||
Returns the sprite ID if the animation is successfully loaded. Returns -1 on errors. |
Example
local sprite = video.createSpriteState("MySprite", "MySpritePackage.dat")
Dawn of Daria Notes
The engine uses the sprite package name to identify when new packages should be loaded. However, when Dawn of Daria loads its graphics it uses the name "dariaClientData/gfx/name.dat", but in the Lua scripts the game will get the full path to the file (e.g. "c:/Games/Daria/dariaClientData/gfx/name.dat"). This causes the error that the gfx package will be loaded twice.
To avoid this problem, Daria uses package aliases when loading files. Use these instead of the file name when loading packages that are used in the game (custom packages are loaded normally).
Alias | Translates to |
---|---|
"ITEMS" | "dariaClientData/gfx/items.dat" |
Unfinished list
local sprite = video.createSpriteState("0010", "ITEMS")