TorqueScript Reference
Public Member Functions | List of all members
SpriteBase Class Reference

#include <SpriteBase_ScriptBinding.h>

Inherits SceneObject.

Inherited by Scroller, and Sprite.

Public Member Functions

String getAnimation ()
 
Integer getAnimationFrame ()
 
Integer getAnimationImageFrame ()
 
String getAnimationNamedImageFrame ()
 
Float getAnimationTime ()
 
Float getAnimationTimeScale ()
 
String getImage ()
 
Integer getImageFrame ()
 
Boolean getIsAnimationFinished ()
 
String getNamedImageFrame ()
 
Boolean isStaticFrameProvider ()
 
Boolean isUsingNamedImageFrame ()
 
void pauseAnimation (bool enable)
 
Boolean playAnimation (string animationAssetId)
 
void setAnimationFrame (int frame)
 
void setAnimationTimeScale (float timeScale)
 
Boolean setImage (imageAssetId, [frame])
 
Boolean setImageFrame (frame)
 
Boolean setNamedImageFrame (frame)
 
void stopAnimation ()
 
- Public Member Functions inherited from SceneObject
void addToScene (Scene scene)
 
void applyAngularImpulse (impulse)
 
void applyForce (worldForce X/Y, [worldPoint X/Y])
 
void applyLinearImpulse (worldImpulse X/Y, [worldPoint X/Y])
 
void applyTorque (torque)
 
void attachGui (guiControl guiObject, SceneWindow window, [sizeControl ?=false], [offset ?=Vector2(0, 0)])
 
void cancelFadeTo ()
 
void cancelGrowTo ()
 
void cancelMoveTo ([autoStop=true])
 
void cancelRotateTo ([autoStop=true])
 
void clearCollisionShapes ()
 
void copyAllCollisionShapes (targetObject[, clearTargetShapes?])
 
Integer copyCollisionShape (int shapeIndex, targetObject)
 
Boolean copyFrom (SceneObject object, [copyDynamicFields?=false])
 
Integer createChainCollisionShape (localPointsX/Y, [adjacentLocalPositionStartX, adjacentLocalPositionStartY], [adjacentLocalPositionEndX, adjacentLocalPositionEndY])
 
Integer createCircleCollisionShape (radius, [localPositionX, localPositionY])
 
Integer createEdgeCollisionShape (localPositionStartX, localPositionStartY, localPositionEndX, localPositionEndY, [adjacentLocalPositionStartX, adjacentLocalPositionStartY], [adjacentLocalPositionEndX, adjacentLocalPositionEndY])
 
Integer createPolygonBoxCollisionShape (width, height, [localCentroidX, localCentroidY], [angle])
 
Integer createPolygonCollisionShape (localPointsX/Y)
 
Boolean deleteCollisionShape (int shapeIndex)
 
void detachAllGuiControls ()
 
void detachGui ()
 
Boolean fadeTo (targetColor red/green/blue/alpha, rate)
 
Boolean fadeToTime (targetColor red/green/blue/alpha, time)
 
String getAABB ()
 
Boolean getActive ()
 
Float getAlphaTest ()
 
Float getAngle ()
 
Float getAngularDamping ()
 
Float getAngularVelocity ()
 
String getArea ()
 
String getAreaMax (...)
 
String getAreaMin ()
 
Boolean getAutoSizing ()
 
Boolean getAwake ()
 
Float getBlendAlpha ()
 
String getBlendColor (allowColorNames)
 
Boolean getBlendMode ()
 
String getBodyType ()
 
Boolean getBullet ()
 
String getChainCollisionShapeAdjacentEnd (int shapeIndex)
 
String getChainCollisionShapeAdjacentStart (int shapeIndex)
 
Boolean getChainCollisionShapeHasAdjacentEnd (int shapeIndex)
 
Boolean getChainCollisionShapeHasAdjacentStart (int shapeIndex)
 
String getChainCollisionShapeLocalPoint (int shapeIndex, int pointIndex)
 
Integer getChainCollisionShapePointCount (int shapeIndex)
 
String getCircleCollisionShapeLocalPosition (int shapeIndex)
 
Float getCircleCollisionShapeRadius (int shapeIndex)
 
Boolean getCollisionCallback ()
 
String getCollisionGroups ()
 
String getCollisionLayers ()
 
String getCollisionMasks (...)
 
Boolean getCollisionOneWay ()
 
Float getCollisionShapeArea (int shapeIndex)
 
Integer getCollisionShapeCount ()
 
Float getCollisionShapeDensity (int shapeIndex)
 
Float getCollisionShapeFriction (int shapeIndex)
 
Boolean getCollisionShapeIsSensor (int shapeIndex)
 
Float getCollisionShapeRestitution (int shapeIndex)
 
String getCollisionShapeType (int shapeIndex)
 
Boolean getCollisionSuppress ()
 
String getContact (contactIndex)
 
Integer getContactCount ()
 
Float getDefaultDensity ()
 
Float getDefaultFriction ()
 
Float getDefaultRestitution ()
 
String getDstBlendFactor ()
 
String getEdgeCollisionShapeAdjacentEnd (int shapeIndex)
 
String getEdgeCollisionShapeAdjacentStart (int shapeIndex)
 
Boolean getEdgeCollisionShapeHasAdjacentEnd (int shapeIndex)
 
Boolean getEdgeCollisionShapeHasAdjacentStart (int shapeIndex)
 
String getEdgeCollisionShapeLocalPositionEnd (int shapeIndex)
 
String getEdgeCollisionShapeLocalPositionStart (int shapeIndex)
 
Boolean getFixedAngle ()
 
Boolean getGatherContacts ()
 
Float getGravityScale ()
 
Float getHeight ()
 
Float getInertia ()
 
Boolean getIsPointInCollisionShape (int shapeIndex, worldPointX/Y)
 
Boolean getIsPointInOOBB (worldPointX/Y)
 
Float getLifetime ()
 
Float getLinearDamping ()
 
String getLinearVelocity ()
 
String getLinearVelocityFromLocalPoint (localPointX/Y)
 
String getLinearVelocityFromWorldPoint (worldPointX/Y)
 
String getLinearVelocityPolar ()
 
Float getLinearVelocityX ()
 
Float getLinearVelocityY ()
 
String getLocalCenter ()
 
String getLocalPoint (float worldPointX/Y)
 
String getLocalVector (float worldVectorX/Y)
 
Float getMass ()
 
Boolean getPickingAllowed ()
 
String getPolygonCollisionShapeLocalPoint (int shapeIndex, int pointIndex)
 
Integer getPolygonCollisionShapePointCount (int shapeIndex)
 
String getPosition ()
 
Float getPositionX ()
 
Float getPositionY ()
 
Float getRenderAngle ()
 
String getRenderGroup ()
 
String getRenderPosition ()
 
Integer getScene ()
 
Integer getSceneGroup ()
 
Integer getSceneLayer ()
 
Float getSceneLayerDepth ()
 
String getSize ()
 
Float getSizeX ()
 
Float getSizeY ()
 
Boolean getSleepingAllowed ()
 
Boolean getSleepingCallback ()
 
String getSortPoint ()
 
Float getSortPointX ()
 
Float getSortPointY ()
 
Integer getSoundatIndex ()
 
Integer getSoundsCount ()
 
String getSrcBlendFactor ()
 
Boolean getUpdateCallback ()
 
Boolean getUseInputEvents ()
 
Boolean getVisible ()
 
Float getWidth ()
 
String getWorldCenter ()
 
String getWorldPoint (float localPointX/Y)
 
String getWorldVector (float localVectorX/Y)
 
Boolean growTo (targetSize width/height, rate rateX/rateY)
 
Boolean growToTime (targetSize width/height, time)
 
Boolean isFadeToComplete ()
 
Boolean isGrowToComplete ()
 
Boolean isMoveToComplete ()
 
Boolean isRotateToComplete ()
 
Boolean moveTo (worldPoint X/Y, speed, [autoStop=true], [snapToTarget=true], [margin=0.1])
 
Integer playSound ()
 
void removeFromScene ()
 
Boolean rotateTo (angle, speed, [autoStop=true], [warpToTarget=true])
 
void safeDelete ()
 
void setActive ([bool status?])
 
void setAlphaTest (float alpha)
 
void setAngle (float angle)
 
void setAngularDamping (float damping)
 
void setAngularVelocity (float velocity)
 
void setArea (float x1, float y1, float x2, float y2)
 
void setAwake ([bool status?])
 
void setBlendAlpha (float alpha)
 
void setBlendColor (float red, float green, float blue, [float alpha=1.0])
 
void setBlendMode (bool blendMode)
 
void setBodyType (bodyType type)
 
void setBullet ([bool status?])
 
void setCollisionAgainst (SceneObject object, [clearMasks?=false])
 
void setCollisionCallback ([bool status?])
 
void setCollisionGroups (groups)
 
void setCollisionLayers (layers)
 
void setCollisionMasks (groupMask, [layerMask])
 
void setCollisionOneWay ([bool status?])
 
void setCollisionShapeDensity (int shapeIndex, float density)
 
void setCollisionShapeFriction (int shapeIndex, float friction)
 
void setCollisionShapeIsSensor (int shapeIndex, bool status)
 
void setCollisionShapeRestitution (int shapeIndex, float restitution)
 
void setCollisionSuppress ([bool status?])
 
void setDebugOff (debugOptions)
 
void setDebugOn (debugOptions)
 
void setDefaultDensity (float density, [bool updateShapes])
 
void setDefaultFriction (float friction, [bool updateShapes])
 
void setDefaultRestitution (float restitution, [bool updateShapes])
 
void setDstBlendFactor (dstBlend)
 
void setEnabled (bool status)
 
void setFixedAngle (bool status?)
 
void setGatherContacts (bool gatherContacts)
 
void setGravityScale (float scale)
 
void setHeight (float height)
 
void setLifetime (float lifetime)
 
void setLinearDamping (float damping)
 
void setLinearVelocity (float velocityX, float velocityY)
 
void setLinearVelocityPolar (float angle, float speed)
 
void setLinearVelocityX (float velocityX)
 
void setLinearVelocityY (float velocityY)
 
void setPickingAllowed (bool pickingAllowed)
 
void setPosition (float x, float y)
 
void setPositionX (float x)
 
void setPositionY (float y)
 
void setRenderGroup (renderGroup)
 
void setSceneGroup (integer group)
 
void setSceneLayer (integer layer)
 
void setSceneLayerDepth (float layerDepth)
 
Boolean setSceneLayerDepthBack ()
 
Boolean setSceneLayerDepthBackward ()
 
Boolean setSceneLayerDepthForward ()
 
Boolean setSceneLayerDepthFront ()
 
void setSize (float width, float height)
 
void setSizeX (float width)
 
void setSizeY (float height)
 
void setSleepingAllowed ([bool status?])
 
void setSleepingCallback ([bool status?])
 
void setSortPoint (float x, float y)
 
void setSortPointX (float x)
 
void setSortPointY (float y)
 
void setSrcBlendFactor (srcBlend)
 
void setUpdateCallback ([bool status?])
 
void setUseInputEvents (bool inputStatus)
 
void setVisible (bool status)
 
void setWidth (float width)
 
void stopSound (S32 index)
 
- Public Member Functions inherited from BehaviorComponent
Boolean addBehavior (BehaviorInstance bi)
 
void clearBehaviors ()
 
Boolean connect (outputBehavior, inputBehavior, outputName, inputName)
 
Boolean disconnect (outputBehavior, inputBehavior, outputName, inputName)
 
Integer getBehavior (string BehaviorTemplateName)
 
Integer getBehaviorByIndex (int index)
 
String getBehaviorConnection (outputBehavior, outputName, connectionIndex)
 
Integer getBehaviorConnectionCount (outputBehavior, outputName)
 
Integer getBehaviorCount ()
 
Boolean raise (outputBehavior, outputName, [deltaTime])
 
Boolean removeBehavior (BehaviorInstance bi, [bool deleteBehavior=true])
 
Boolean reOrder (BehaviorInstance inst, [int desiredIndex=0])
 
- Public Member Functions inherited from DynamicConsoleMethodComponent
String callOnBehaviors (methodName, argi)
 
- Public Member Functions inherited from SimComponent
Boolean addComponents (compObjName, compObjName2,...)
 
Integer getComponent (idx)
 
Integer getComponentCount ()
 
Boolean isEnabled ()
 
Boolean removeComponents (compObjName, compObjName2,...)
 
void setEnabled (enabled)
 
- Public Member Functions inherited from SimObject
void assignFieldsFrom (SimObject)
 
Integer clone ([copyDynamicFields=false]?)
 
void delete ()
 
Integer getId ()
 
void setName (newName)
 
String getName ()
 
String getClassNamespace ()
 
String getSuperClassNamespace ()
 
void setClassNamespace (nameSpace)
 
void setSuperClassNamespace ()
 
Boolean isMethod (string methodName)
 
String call (methodName, [args] *)
 
void dumpClassHierarchy ()
 
void dump ()
 
Boolean isMemberOfClass (string classname)
 
String getClassName ()
 
String getFieldValue (fieldName)
 
Boolean setFieldValue (fieldName, value)
 
Boolean setEditFieldValue (fieldName, value)
 
Integer getDynamicFieldCount ()
 
String getDynamicField (index)
 
Integer getFieldCount ()
 
String getField (int index)
 
void setProgenitorFile (file)
 
String getProgenitorFile ()
 
Integer getType ()
 
String getFieldType (fieldName)
 
void setInternalName (string InternalName)
 
String getInternalName ()
 
Boolean isChildOfGroup (groupID)
 
Integer getGroup ()
 
Boolean startTimer (callbackFunction, float timePeriod, [repeat]?)
 
void stopTimer ()
 
Boolean isTimerActive ()
 
Integer schedule (time, command, [arg] *)
 
void startListening (SimObject)
 
void stopListening (SimObject)
 
void addListener (SimObject)
 
void removeListener (SimObject)
 
void removeAllListeners ()
 
void postEvent (String eventName, String data)
 
Boolean save (fileName, [selectedOnly]?)
 
void addFieldFilter (fieldName)
 
void removeFieldFilter (fieldName)
 

Member Function Documentation

◆ getAnimation()

String getAnimation ( )

Gets current animation asset Id.

Returns
(string AnimationAssetId) The current animation asset Id.

◆ getAnimationFrame()

Integer getAnimationFrame ( )

Gets current frame index used in the animation. IMPORTANT: this is not the image frame number!

Returns
The current numerical animation frame

◆ getAnimationImageFrame()

Integer getAnimationImageFrame ( )

Gets current numerical image frame used in the animation.

Returns
The current numerical animation frame

◆ getAnimationNamedImageFrame()

String getAnimationNamedImageFrame ( )

Gets current named image frame used in the animation.

Returns
The current named animation frame

◆ getAnimationTime()

Float getAnimationTime ( )

Gets current animation time.

Returns
(float time) The current animation time

◆ getAnimationTimeScale()

Float getAnimationTimeScale ( )

Get the animation time scale for this sprite.

Returns
(float) Returns the animation time scale for this sprite.

◆ getImage()

String getImage ( )

Gets current image asset Id.

Returns
(string imageAssetId) The image being displayed

◆ getImageFrame()

Integer getImageFrame ( )

Gets the current numerical or named image frame.

Returns
The current numerical or named image frame.

◆ getIsAnimationFinished()

Boolean getIsAnimationFinished ( )

Checks animation status.

Returns
(bool finished) Whether or not the animation is finished

◆ getNamedImageFrame()

String getNamedImageFrame ( )

Gets the current named image frame.

Returns
The current named image frame.

◆ isStaticFrameProvider()

Boolean isStaticFrameProvider ( )

Gets whether the sprite is in static or dynamic (animated)mode.

Returns
Returns whether the sprite is in static or dynamic (animated)mode.

◆ isUsingNamedImageFrame()

Boolean isUsingNamedImageFrame ( )

Gets whether the sprite is using a numerical or named image frame.

Returns
Returns true when using a named frame, false when using a numerical index.

◆ pauseAnimation()

void pauseAnimation ( bool  enable)

Pause the current animation

Parameters
enableIf true, pause the animation. If false, continue animating

◆ playAnimation()

Boolean playAnimation ( string  animationAssetId)

Plays an animation.

Parameters
animationAssetIdThe animation asset Id to play.
Returns
Returns true on success.

◆ setAnimationFrame()

void setAnimationFrame ( int  frame)

Sets the current animation frame. IMPORTANT: this is not the image frame number used in the animation!

Parameters
frameWhich frame of the animation to display
Returns
No return value.

◆ setAnimationTimeScale()

void setAnimationTimeScale ( float  timeScale)

Change the rate of animation.

Parameters
timeScaleValue which will scale the frame animation speed. 1 by default.

◆ setImage()

Boolean setImage ( imageAssetId  )

Sets the sprite image and optionally frame.

Parameters
imageAssetIdThe image asset Id to display
frameThe numerical or named frame of the image to display
Returns
Returns true on success.

◆ setImageFrame()

Boolean setImageFrame ( frame  )

Sets the image frame using a numerical index.

Parameters
frameThe numerical frame to display
Returns
Returns true on success.

◆ setNamedImageFrame()

Boolean setNamedImageFrame ( frame  )

Sets the image frame using a named string.

Parameters
frameThe named frame to display
Returns
Returns true on success.

◆ stopAnimation()

void stopAnimation ( )

Stop the current animation

Returns
No return value.