| 1.85 Sprite . |
| 1.85.1 Sprite.Create . |
| 1.85.2 Sprite.GetColor .725 |
| 1.85.3 Sprite.GetElapsedAnimTime .726 |
| 1.85.4 Sprite.GetPosition .727 |
| 1.85.5 Sprite.GetRotation .727 |
| 1.85.6 Sprite.GetScale .728 |
| 1.85.7 Sprite.GetTotalAnimTime .728 |
| 1.85.8 Sprite.IsAnimPaused .729 |
| 1.85.9 Sprite.IsAnimPlaying .730 |
| 1.85.10 Sprite.PauseAnim .730 |
| 1.85.11 Sprite.PlayAnim .731 |
| 1.85.12 Sprite.ResumeAnim .731 |
| 1.85.13 Sprite.SetColor .732 |
| 1.85.14 Sprite.SetPosition .733 |
| 1.85.15 Sprite.SetRotation .733 |
| 1.85.16 Sprite.SetScale .734 |
| 1.85.17 Sprite.SetTexture.734 |
| 1.85.18 Sprite.SetUvs .735 |
| 1.85.19 Sprite.StopAnim .736 |
| 1.86 SpriteAnim .736 |
| 1.86.1 SpriteAnim.AddFrames .736 |
| 1.86.2 SpriteAnim.Create .737 |
| 1.86.3 SpriteAnim.IsLooping .738 |
| 1.86.4 SpriteAnim.SetLooping .738 |
|
|
| Sprite |
| Sprite.Create |
| Brief |
| Creates a new Sprite object. |
| Definition |
| ! Sprite Sprite.Create() |
| Arguments |
| None |
| Return Values |
| A new Sprite instance. |
| Description |
| Creates a new Sprite object. |
| Examples |
| ! sprite = Sprite.Create() |
| See Also |
| � Renderer.DrawSprite |
| Sprite.GetColor |
| Brief |
| Returns the color of the sprite as a Vector4. |
| Definition |
| Vector4 Sprite.GetColor( Sprite sprite ) |
| Sprite.GetPosition( Sprite sprite, Vector4 outColor ) |
| Arguments |
| sprite - The sprite to query.outColor - (out) The vector to receive the color. |
| Return Values |
| A Vector4 containing the RGBA values (in that order) of the sprite. |
| Description |
| Returns the color of the sprite as a Vector4 where x is red, y, is green, z is blue, w is alpha. They range from 0 to 1 where 1 is the maximum color. |
| Examples |
| ! col = Sprite.GetColor ( sprite ) |
| I print( col ) |
| See Also |
| � Sprite.SetColor |
| Sprite. GetElapsedAnimTime |
| Brief |
| Returns the elapsed animation time in seconds. |
| Definition |
| number Sprite.GetElapsedAnimTime( Sprite sprite ) |
| Arguments |
| sprite - The sprite to query. |
| Return Values |
| The elapsed time in seconds of the sprite's animation. |
| Description |
| Returns the elapsed animation time in seconds. |
| Examples |
| ! print( Sprite.GetElapsedAnimTime( sprite ) ) |
| See Also |
| � Sprite. GetTotalAnimTime |
| � Sprite. IsAnimPaused |
| � Sprite.PlayAnim |
| � Sprite. ResumeAnim |
| � Sprite.StopAnim |
| Sprite.GetPosition |
| Brief |
| Returns the screen space coordinate of a sprite. |
| Definition |
| Vector4 Sprite.GetPosition( Sprite sprite ) |
| Sprite.GetPosition( Sprite sprite, Vector4 outPos ) |
| Arguments |
| sprite - The sprite to query.outPos - (out) The vector to receive the position. |
| Return Values |
| A Vector4 object containing the screen space position of the sprite. Only the X and Y members will be valid. |
| Description |
| Returns the position of the sprite. Note that this vector is a copy created by the function and so changing its value will not change the sprite. |
| Examples |
| ! pos = Sprite.GetPosition( sprite ) |
| i print( pos ) |
| See Also |
| � Sprite. SetPosition |
| Sprite.GetRotation |
| Brief |
| Returns the angle of rotation of the sprite. |
| Definition |
| ! number Sprite.GetRotation( Sprite sprite ) |
| Arguments |
| sprite - The sprite to query. |
| Return Values |
| A floating point value containing the rotation in degrees of the sprite. |
| Description |
| Returns the angle of rotation in degrees of the sprite. |
| Examples |
| rot = Sprite.GetRotation( sprite ) |
| print ( rot .. " degrees" ) |
| See Also |
| � Sprite.SetRotation |
| Sprite. GetScale |
| Brief |
| Returns as a Vector4 the scale of the sprite. |
| Definition |
| Vector4 Sprite.GetScale( Sprite sprite ) |
| Sprite.GetScale( Sprite sprite, Vector4 outScale ) |
| Arguments |
| sprite - The sprite to query.outScale - (out) The vector to receive the scale. |
| Return Values |
| A Vector4 instance containing the sprite's scale. Only the X and Y members will be valid. |
| Description |
| Returns the scale of the sprite. Note that this vector is a copy of the vector and so changing its value will not change the sprite. |
| Examples |
| ! scale = Sprite.GetScale ( sprite ) |
| | print( scale ) |
| See Also |
| � Sprite.GetScale |
| Sprite.GetTotalAnimTime |
| Brief |
| Returns the total animation time in seconds. |
| Definition |
| number Sprite.GetTotalAnimTime( Sprite sprite ) |
| Arguments |
| sprite - The sprite to query. |
| Return Values |
| The length in seconds of the sprite's animation. |
| Description |
| Returns the total animation time in seconds. If the animation is looping it returns the total time for one loop of the animation. |
| Examples |
| ! print( Sprite.GetTotalAnimTime( sprite ) ) |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite. IsAnimPaused |
| � Sprite. PlayAnim |
| � Sprite. ResumeAnim |
| � Sprite. StopAnim |
| Sprite.IsAnimPaused |
| Brief |
| Reports if the animation is paused. |
| Definition |
| ! boolean Sprite.IsAnimPaused( Sprite sprite ) |
| Arguments |
| sprite - The sprite to query. |
| Return Values |
| true if the sprite's animation is paused, false otherwise. |
| Description |
| Returns true if the sprite's animation is paused (using Sprite.PauseAnim) and false otherwise. |
| Examples |
| ! if Sprite.IsAnimPaused( sprite ) then |
| print( "Animation is paused" ) |
| | end |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite.GetTotalAnimTime |
| � Sprite.PlayAnim |
| � Sprite.ResumeAnim |
| � Sprite.StopAnim |
| Sprite. IsAnimPlaying |
| Brief |
| Reports if an animation is playing on the sprite. |
| Definition |
| 1 boolean Sprite.IsAnimPlaying( Sprite sprite ) |
| Arguments |
| sprite - The sprite to query. |
| Return Values |
| true if an animation is playing and false otherwise. |
| Description |
| Returns true if an animation is playing and false otherwise. Note that it is still considered as playing even if the animation is paused. |
| Examples |
| if Sprite.IsAnimPlaying( sprite ) then |
| print( "Playing an animation" ) |
| end |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite. GetTotalAnimTime |
| � Sprite. PlayAnim |
| � Sprite. ResumeAnim |
| � Sprite. StopAnim |
| Sprite.PauseAnim |
| Brief |
| Pauses an animation. |
| Definition |
| ! Sprite.PauseAnim( Sprite sprite ) |
| Arguments |
| sprite - The sprite to update. |
| Return Values |
| None. |
| Description |
| Pauses an animation. It can then be resumed with ResumeAnim. |
| Examples |
| ! Sprite.PauseAnim( sprite ) |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite. GetTotalAnimTime |
| � Sprite.PlayAnim |
| � Sprite.ResumeAnim |
| � Sprite. StopAnim |
| Sprite.PlayAnim |
| Brief |
| Plays a texture animation on the sprite. |
| Definition |
| ! Sprite.PlayAnim( Sprite sprite, SpriteAnim anim, number framesPerSecond =1.0 ) |
| Arguments |
| sprite - The sprite to update.anim - The animation to apply on the sprite.framesPerSecond - The number of animation frames to be displayed |
| every second. |
| Return Values |
| None. |
| Description |
| Plays a texture animation with the specified anim at the given animation speed. The Sprites UVs are overwritten with the UVs from the animation. |
| Examples |
| ! Sprite.PlayAnim( sprite, anim, 30 ) |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite.GetTotalAnimTime |
| � Sprite.PauseAnim |
| � Sprite.ResumeAnim |
| � Sprite.StopAnim |
| Sprite.ResumeAnim |
| Brief |
| Resumes a paused animation. |
| Definition |
| Sprite.ResumeAnim( Sprite sprite ) |
| Arguments |
| sprite - The sprite to update. |
| Return Values |
| None. |
| Description |
| Resumes a paused animation. |
| Examples |
| ! Sprite.ResumeAnim( sprite ) |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite. GetTotalAnimTime |
| � Sprite.PauseAnim |
| � Sprite. PlayAnim |
| � Sprite. StopAnim |
| Sprite.SetColor |
| Brief |
| Sets the color of the sprite. |
| Definition |
| Sprite.SetColor( Sprite sprite, Vector4 rgba ) |
| Sprite.SetColor( Sprite sprite, number red = 1, number green = 1, number blue = 1, number alpha = 1 ) |
| Arguments |
| sprite - The sprite to update.rgba - A Vector4 containing the RGBA values where each component must be between 0.0 and 1.0.red - The red |
| component, ranges from 0 to 1. Defaults to 1 .green - The green component, ranges from 0 to 1. Defaults to 1 .blue - The blue component, ranges |
| from 0 to 1. Defaults to 1 .alpha - The alpha component, ranges from 0 to 1. Defaults to 1. |
| Return Values |
| None. |
| Description |
| Sets the color of the sprite. |
| Examples |
| redHalfAlpha = Vector4.Create( 1, 0, 0, 0.5 ) |
| sprite = Sprite.Create() |
| Sprite.SetColor( sprite, redHalfAlpha ) |
| See Also |
| � Sprite.GetColor |
| Sprite.SetPosition |
| Brief |
| Sets the position of the sprite. |
| Definition |
| Sprite.SetPosition( Sprite sprite, Vector4 position ) |
| Sprite.SetPosition( Sprite sprite, number x = 0, number y = 0 ) |
| Arguments |
| sprite - The sprite to update.position - The new sprite position, where only the X and Y members are used.x - The X component of the sprite |
| position.y - The Y component of the sprite position. |
| Return Values |
| None. |
| Description |
| Sets the screen coordinate of the sprite. The position specifies the coordinate of the center of the sprite. |
| Examples |
| pos = Vector4.Create( 10, 10 ) |
| sprite = Sprite.Create() |
| Sprite.SetPosition( sprite, pos ) |
| See Also |
| � Sprite.GetPosition |
| Sprite.SetRotation |
| Brief |
| Sets the rotation of the sprite. |
| Definition |
| Sprite.SetRotation( Sprite sprite, number rotation ) |
| Arguments |
| sprite - The sprite to update.rotation - The new sprite rotation (in degrees). |
| Return Values |
| None. |
| Description |
| Sets the rotation of the sprite in degrees. |
| Examples |
| sprite = Sprite.Create() |
| Sprite.SetRotation( sprite, 90.0 ) |
| See Also |
| � Sprite.GetRotation |
| Sprite.SetScale |
| Brief |
| Sets the scale of the sprite. |
| Definition |
| Sprite.SetScale( Sprite sprite, Vector4 vector ) |
| Sprite.SetScale( Sprite sprite, number x = 1, number y = 1 ) |
| Arguments |
| sprite - The sprite to update.vector - The new sprite scale, where only the X and Y members are used.x - The horizontal sprite scale.y - The |
| vertical sprite scale. |
| Return Values |
| None. |
| Description |
| Sets the x and y scale of the sprite. |
| Examples |
| scale = Vector4.Create ( 10, 10 ) |
| sprite = Sprite.Create () |
| Sprite.SetScale ( sprite, scale ) |
| See Also |
| � Sprite.GetScale |
| Sprite.SetTexture |
| Brief |
| Sets the current texture of the sprite. |
| Definition |
| Sprite.SetTexture( Sprite sprite, Texture texture ) |
| Arguments |
| sprite - The sprite to update.texture - An instance of the Texture class that will represent the graphic of the sprite. |
| Return Values |
| None. |
| Description |
| Sets the current texture of the sprite. Note that this texture is replaced if an animation is played on the sprite. The UVs are set to default, i.e. the |
| whole of the texture. |
| Examples |
| sprite = Sprite.Create() |
| Sprite.SetTexture( sprite. Texture.Find( "SpriteTexture" ) ) |
| See Also |
| � Sprite.SetUvs |
| Sprite.SetUvs |
| Brief |
| Sets the UVs of the sprite. |
| Definition |
| Sprite.SetUvs( Sprite sprite. |
| Sprite.SetUvs( Sprite sprite, |
| Sprite.SetUvs( Sprite sprite, |
| number tru, number trv ) |
| Sprite.SetUvs( Sprite sprite. |
| number tlu, number tlv, number bru, |
| Vector4 tlbr ) |
| number tlu, number tlv, number blu, |
| Vector4 tlbl, Vector4 brtr ) |
| number brv ) |
| number blv, number bru, number brv. |
| Arguments |
| sprite - The sprite to update.tlu - The u-component of the top left texture coordinate for the sprite.tlv - The v-component of the top left texture |
| coordinate for the sprite.blu - The u-component of the bottom left texture coordinate for the sprite.blv - The v-component of the bottom left texture |
| coordinate for the sprite.bru - The u-component of the bottom right texture coordinate for the sprite.brv - The v-component of the bottom right |
| texture coordinate for the sprite.tru - The u-component of the top right texture coordinate for the sprite.trv - The v-component of the top right |
| texture coordinate for the sprite.tlbr - A vector containing the top left and bottom right UV coordinates for the sprite.tlbl - A vector containing the |
| top left and bottom left UV coordinates for the sprite.brtr - A vector containing the bottom right and top right UV coordinates for the sprite. |
| Return Values |
| None. |
| Description |
| Sets the UVs of the sprite. If passing in 4 numbers either as numbers or packed inside a Vector4 it assumes a rectangle and generates the two |
| other uvs from the two uvs specified. If 4 uvs are supplied it uses them as is. The default uvs for a Sprite are [ 0,0 ],[ 0,1 ],[ 1,1 ],[ 1,0 ]. Also, UVs |
| are set to the default when Sprite.SetTexture is called or Sprite.PlayAnim. |
| Examples |
| sprite = Sprite.Create() |
| Sprite.SetTexture( sprite, texture ) |
| � Example 1: Set to default UVs using each prototype |
| Sprite.SetUvs( sprite, 0, 0, 1, 1 ) |
| Sprite.SetUvs( sprite, Vector4.Create( 0, 0, 1, 1 ) ) |
| Sprite.SetUvs( sprite, 0, 0, 0, 1, 1, 1, 1, 0 ) |
| Sprite.SetUvs( sprite, Vector4.Create( 0, 0, 0, 1 ), Vector4.Create( 1, 1, 1, 0 ) ) |
| � Example 2: Set the sprite to use the top left quadrant of the texture |
| Sprite.SetUvs( sprite, 0, 0, 0.5, 0.5 ) |
| See Also |
| � Sprite.SetTexture |
| � Sprite.PlayAnim |
| Sprite.StopAnim |
| Brief |
| Stops the current animation if it is playing. |
| Definition |
| ! Sprite.StopAnim( Sprite sprite ) |
| Arguments |
| sprite - The sprite to update. |
| Return Values |
| None. |
| Description |
| Stops the current animation if it is playing. The sprite's texture is left at whatever was last displayed. |
| Examples |
| ! Sprite.StopAnim( sprite ) |
| See Also |
| � Sprite.GetElapsedAnimTime |
| � Sprite. GetTotalAnimTime |
| � Sprite.PauseAnim |
| � Sprite.PlayAnim |
| � Sprite. ResumeAnim |
| SpriteAnim |
| SpriteAnim.AddFrames |
| Brief |
| Adds one or more new frames to an animation. |
| Definition |
| SpriteAnim.AddFrames( SpriteAnim anim, Texture texture, number frameWidth = textureWidth, number |
| frameHeight = textureHeight ) |
| Arguments |
| texture - the new frame of animation.frameWidth - the width of the frame (defaults to the width of the specified texture).frameHeight - the width of |
| the frame (defaults to the height of the specified texture). |
| Return Values |
| None. |
| Description |
| Adds one or more new frames to an animation. If frameWidth and/or frameHeight is specified it subdivides the texture up into several frames, |
| where frames are in left to right and then top to bottom order. |
| Examples |
| � Create a 2 frame sprite animation |
| anim = SpriteAnim.Create() |
| SpriteAnim.AddFrames( anim, Texture.Find( "imagel" ) ) |
| SpriteAnim.AddFrames( anim, Texture.Find( "image2" ) ) |
| � Loop the animation every second |
| sprite = Sprite.Create() |
| Sprite.PlayAnim( sprite, anim, 2 ) |
| See Also |
| � Sprite.Create |
| � Sprite.PlayAnim |
| � SpriteAnim.Create |
| SpriteAnim.Create |
| Brief |
| Creates a new SpriteAnim object. |
| Definition |
| SpriteAnim SpriteAnim.Create() |
| Arguments |
| None |
| Return Values |
| A new SpriteAnim instance. |
| Description |
| Creates a new SpriteAnim object. |
| Examples |
| ! anim = SpriteAnim.Create() |
| See Also |
| � SpriteAnim. AddFrames |
| SpriteAnim.IsLooping |
| Brief |
| Reports if the animation is looping or not. |
| Definition |
| ! boolean SpriteAnim.IsLooping( SpriteAnim anim ) |
| Arguments |
| anim - The srite anim object. |
| Return Values |
| Returns true if the animation has been set to looping and false otherwise. |
| Description |
| Reports if the animation is looping or not. |
| Examples |
| ! print( SpriteAnim.IsLooping( myAnim ) ) |
| See Also |
| � SpriteAnim.SetLooping |
| SpriteAnim.SetLooping |
| Brief |
| Sets the animation looping status. |
| Definition |
| ! SpriteAnim.SetLooping( SpriteAnim anim, boolean value ) |
| Arguments |
| value - true to make the animation to loop, false to make the animation play once. |
| Return Values |
| None. |
| Description |
| Sets the animation to loop or not. |
| Examples |
| ! anim = SpriteAnim.Create() |
| ! SpriteAnim.SetLooping( anim, true ) |
| See Also |
| � SpriteAnim.IsLooping |
|
|