CreateSpriteState

From OxeyeWiki

Revision as of 12:53, 5 March 2009 by Jeb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Daisymoon Video Lib

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")
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox