Difference between revisions of "Sprite"
Line 5: | Line 5: | ||
'''<translate>Available since</translate>:''' Gideros 2011.6<br/> | '''<translate>Available since</translate>:''' Gideros 2011.6<br/> | ||
'''<translate>Inherits from</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/> | '''<translate>Inherits from</translate>:''' [[Special:MyLanguage/EventDispatcher|EventDispatcher]]<br/> | ||
+ | |||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
− | + | The [[Special:MyLanguage/Sprite|Sprite]] class is the base class for all objects that can be placed on the scene tree. It is the basic scene tree building block. | |
− | The [[Special:MyLanguage/Sprite|Sprite]] class is the base class for all objects that can be placed on the scene tree. It is the basic scene tree building block. | + | |
A sprite can contain child sprites which makes the scene tree hierarchy. | A sprite can contain child sprites which makes the scene tree hierarchy. | ||
− | Transformations such as translation, rotation, scaling, and color transforms, propagate its effect to all of its children. | + | Transformations such as translation, rotation, scaling, and color transforms, propagate its effect to all of its children. |
− | The drawing order is defined by the order of children. The first child is drawn first and the last child is drawn last. It is possible to change the drawing order by modifying the order of child list. | + | |
− | A [[Special:MyLanguage/Sprite|Sprite]] instance can exist without attaching the scene tree. | + | The drawing order is defined by the order of children. The first child is drawn first and the last child is drawn last. It is possible to change the drawing order by modifying the order of child list. |
− | An unattached sprite can receive [[Special:MyLanguage/Event.ENTER_FRAME|Event.ENTER_FRAME]] event but it will only receive mouse and touch events when it is attached to the scene tree. | + | |
+ | A [[Special:MyLanguage/Sprite|Sprite]] instance can exist without attaching the scene tree. | ||
+ | |||
+ | An unattached sprite can receive [[Special:MyLanguage/Event.ENTER_FRAME|Event.ENTER_FRAME]] event but it will only receive mouse and touch events when it is attached to the scene tree. | ||
+ | |||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | |||
=== <translate>Methods</translate> === | === <translate>Methods</translate> === | ||
[[Special:MyLanguage/Sprite.new|Sprite.new]] ''<translate>creates a new Sprite object</translate>''<br/><!-- GIDEROSMTD:Sprite.new() creates a new Sprite object --> | [[Special:MyLanguage/Sprite.new|Sprite.new]] ''<translate>creates a new Sprite object</translate>''<br/><!-- GIDEROSMTD:Sprite.new() creates a new Sprite object --> | ||
Line 90: | Line 94: | ||
[[Special:MyLanguage/Sprite:swapChildren|Sprite:swapChildren]] ''<translate>Swap two children index places</translate>''<br/><!-- GIDEROSMTD:Sprite:swapChildren(child1,child2) Swap two children index places --> | [[Special:MyLanguage/Sprite:swapChildren|Sprite:swapChildren]] ''<translate>Swap two children index places</translate>''<br/><!-- GIDEROSMTD:Sprite:swapChildren(child1,child2) Swap two children index places --> | ||
[[Special:MyLanguage/Sprite:swapChildrenAt|Sprite:swapChildrenAt]] ''<translate>Swaps two child sprites.</translate>''<br/><!-- GIDEROSMTD:Sprite:swapChildrenAt(index1,index2) Swaps two child sprites. --> | [[Special:MyLanguage/Sprite:swapChildrenAt|Sprite:swapChildrenAt]] ''<translate>Swaps two child sprites.</translate>''<br/><!-- GIDEROSMTD:Sprite:swapChildrenAt(index1,index2) Swaps two child sprites. --> | ||
+ | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | |||
=== <translate>Events</translate> === | === <translate>Events</translate> === | ||
[[Special:MyLanguage/Event.ADDED_TO_STAGE|Event.ADDED_TO_STAGE]]<br/><!-- GIDEROSEVT:Event.ADDED_TO_STAGE addedToStage--> | [[Special:MyLanguage/Event.ADDED_TO_STAGE|Event.ADDED_TO_STAGE]]<br/><!-- GIDEROSEVT:Event.ADDED_TO_STAGE addedToStage--> | ||
Line 128: | Line 132: | ||
[[Special:MyLanguage/Sprite.SCREEN|Sprite.SCREEN]]<br/><!-- GIDEROSCST:Sprite.SCREEN screen--> | [[Special:MyLanguage/Sprite.SCREEN|Sprite.SCREEN]]<br/><!-- GIDEROSCST:Sprite.SCREEN screen--> | ||
|} | |} | ||
− | |||
− |
Revision as of 00:11, 10 December 2019
Supported platforms:
Available since: Gideros 2011.6
Inherits from: EventDispatcher
Description
The Sprite class is the base class for all objects that can be placed on the scene tree. It is the basic scene tree building block.
A sprite can contain child sprites which makes the scene tree hierarchy. Transformations such as translation, rotation, scaling, and color transforms, propagate its effect to all of its children.
The drawing order is defined by the order of children. The first child is drawn first and the last child is drawn last. It is possible to change the drawing order by modifying the order of child list.
A Sprite instance can exist without attaching the scene tree.
An unattached sprite can receive Event.ENTER_FRAME event but it will only receive mouse and touch events when it is attached to the scene tree.
MethodsSprite.new creates a new Sprite object |
EventsEvent.ADDED_TO_STAGE ConstantsSprite.ADD |