Nirvana2D [RCBasic Doc]

## Nirvana2D API

Type Nirvana_Sprite

- Dim Name$
- Dim BaseName$
- Dim Sprite_ID
- Dim Animation_Name_Index
- Dim Animation_Count

Type Nirvana_Shape

- Dim Sprite_ID
- Dim ShapeType

Function Nirvana_CreateSprite(spriteDefinition_name$, sprite_name$) As Nirvana_Sprite

- Create a Nirvana Sprite
  - NOTE: spriteDefinition_name$ is the name of the base sprite created in the Sprite Editor

Function Nirvana_GetLayerSpriteCount(layer_index)

- Returns the number of sprites in a layer

Function Nirvana_GetLayerSpriteIndex(layer_index, sprite_name$)

- Returns the Nirvana sprite index of the given sprite name in the given layer or -1 if sprite is not found

Function Nirvana_GetLayerShapeCount(layer_index)

- Returns the number of stage collision shapes in the given layer

Function Nirvana_GetSpriteID(sprite_index)

- Returns the RCBasic sprite id of the given Nirvana sprite index or -1 if the sprite index is not valid
  - NOTE: If the sprite is detached then this will return the ID of the render sprite

Function Nirvana_GetSpriteName$(sprite_index)

- Returns the sprite name of the given Nirvana sprite index or an empty string if sprite index is not valid

Function Nirvana_GetSpriteDefinitionName$(sprite_index)

- Returns the sprite definition name of the given sprite index
  - NOTE: Sprite Definition name is the name of the base sprite created in the Sprite Editor and not the name of the sprite in the stage
  - NOTE: There is almost no reason to get this definition name unless you wanted to look up sprites in the stage by the base sprite

Function Nirvana_GetSpriteIsDetached(sprite_index)

- Returns true if the sprite has a detached render body and dynamics body

Function Nirvana_GetDetachedSpriteID(sprite_index)

- Returns the sprite dynamics body ID
  - NOTE: This is the body that should be used for physics operations

Function Nirvana_GetSpriteAnimationCount(sprite_index)

- Returns the number of animations for the given Nirvana sprite index

Function Nirvana_GetSpriteAnimationName$(sprite_index, animation_num)

- Returns the name of the given Nirvana Sprite Index animation number