http://www.oxeyegames.com/wiki/index.php?title=CreateSpriteState&feed=atom&action=historyCreateSpriteState - Revision history2024-03-29T07:59:18ZRevision history for this page on the wikiMediaWiki 1.16.0http://www.oxeyegames.com/wiki/index.php?title=CreateSpriteState&diff=30&oldid=prevJeb: Created page with '{{VideoMethod | video.createSpriteState(animationName, gfxPackageName) | This method creates a new sprite animation state and returns its ID value. The sprite animation is locate...'2009-03-05T12:53:40Z<p>Created page with '{{VideoMethod | video.createSpriteState(animationName, gfxPackageName) | This method creates a new sprite animation state and returns its ID value. The sprite animation is locate...'</p>
<p><b>New page</b></p><div>{{VideoMethod<br />
|<br />
video.createSpriteState(animationName, gfxPackageName)<br />
|<br />
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 [[Daisymoon Source Folder|source folder]].<br />
|<br />
{{MethodParam|animationName|A string|The name of the animation as it is written in the gfx package. The name is case sensitive.}}<br />
{{MethodParam|gfxPackageName|A string|The name of the gfx package, relative to the source folder. The name is case sensitive on Mac OS X}}<br />
|<br />
Returns the sprite ID if the animation is successfully loaded. Returns -1 on errors.<br />
}}<br />
=== Example ===<br />
<pre><br />
local sprite = video.createSpriteState("MySprite", "MySpritePackage.dat")<br />
</pre><br />
<br />
=== Dawn of Daria Notes ===<br />
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.<br />
<br />
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).<br />
{| border=1 |<br />
!| Alias || Translates to<br />
|-<br />
| "ITEMS" || "dariaClientData/gfx/items.dat"<br />
|}<br />
''Unfinished list''<br />
<br />
<pre><br />
local sprite = video.createSpriteState("0010", "ITEMS")<br />
</pre></div>Jeb