new CB_GraphicSpritesScene( [spritesGroups] [, byReference]) → {CB_GraphicSpritesScene}
Class to manage different groups of graphic sprites (2D or 3D). Internally, it manages CB_GraphicSprites objects.
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
spritesGroups |
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT |
<optional> |
Object with the desired groups of sprites. The information will be used for the |
|
byReference |
boolean |
<optional> |
false | This value will be used as the "byReference" parameter of the constructor when creating the new internal |
- Source:
- To Do:
-
- Think about a "createCopy" parameter on different the insert methods (to insert sprites groups/graphic sprites objects, etc.) so it will make a copy of the object to avoid using/modifying the original one. If the "createCopy" is set to false, it should always use the object as reference (using/modifying it).
- Think about a method to remove a sprite group object when the same sprite group is received by parameter. The same to remove a
CB_GraphicSpritesobject, receiving aCB_GraphicSpritesobject by parameter. The same to remove the sprites groups object, receiving a sprites groups object by parameter. Only remove them if they match exactly. - Think about a method to insert
CB_GraphicSpritesobject directly. The same with a method that inserts manyCB_GraphicSpritesobjects (receiving an array with them).
Returns:
Returns a new CB_GraphicSpritesScene object.
Members
-
<readonly> id :string|*
-
Identifier of the sprites groups object (the "id" property of the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTstored in theCB_GraphicSpritesScene#spritesGroupsproperty) and theCB_GraphicSpritesSceneobject itself (same one). It should be unique. It must be a value which evaluates to true. By default, it is generated automatically (with an internal counter).Type:
- string | *
- Default Value:
-
- 'CB_GraphicSpritesScene_' + CB_GraphicSpritesScene._idUnique++
- Source:
-
<constant> isSpritesScene :boolean
-
Property which is always set to true to help identify this type of object.
Type:
- boolean
- Default Value:
-
- true
- Source:
-
<readonly> parent :*
-
Property pointing to or containing its parent. It is the same as the "parent" property of the
CB_GraphicSprites.SPRITES_GROUPS_OBJECTstored in theCB_GraphicSprites#spritesGroupsproperty.Type:
- *
-
<readonly> spritesGroups :SPRITES_GROUPS_OBJECT
-
Object containing all the internally-created
CB_GraphicSpritesobjects and their information.Type:
- SPRITES_GROUPS_OBJECT
- Default Value:
-
- {}
- Source:
-
<constant> type :string
-
Indicates the type of object (always "spritesScene").
Type:
- string
- Default Value:
-
- spritesScene
- Source:
Methods
-
destructor()
-
Destroys the graphic sprites scene object (removing all the sprites groups and the internal
CB_GraphicSpritesobjects, etc.) and frees memory. -
executeAll()
-
Alias for
CB_GraphicSpritesScene#executeFunctionAll. -
executeFunctionAll(functionEach [, orderedByZIndex] [, delayBetweenEach] [, graphicSpritesObjects] [, returnSetTimeoutsArray] [, delayBetweenEachAffectsFirst] [, functionFinish]) → {integer|array}
-
Performs a desired action, using the provided function, on all the existing
CB_GraphicSpritesobjects or on the desired ones (if provided). Calls theCB_Arrays.executeFunctionAllfunction internally and returns its returning value.Parameters:
Name Type Argument Default Description functionEachCB_Arrays.executeFunctionAll_ON_LOOP_CALLBACK Function that will be called for each
CB_GraphicSpritesobject. As the first parameter it receives theCB_GraphicSpritesobject of the "graphicSpritesObjects" being looped, as the second parameter the position of thisCB_GraphicSpritesobject in the "graphicSpritesObjects" array provided (or, if not provided, in the array returned by theCB_GraphicSpritesScene#getGraphicSpritesAllmethod), the third parameter is the array being looped and the fourth parameter will be the "delayBetweenEach" being used, being "this" theCB_GraphicSpritesobject itself.orderedByZIndexboolean <optional>
false If set to true, it will loop the
CB_GraphicSpritessorted by their z-index (ascending order).delayBetweenEachnumber | CB_Arrays.executeFunctionAll_ON_LOOP_CALLBACK <optional>
0 If a value greater than zero is used, it will be used as the delay desired between each call to the "functionEach" function (calling them using the setTimeout function internally). If not provided or the value is 0 (zero) or lower, each call to the "functionEach" function will be performed immediately one after the other. If a function is provided, it will be called with the same parameters as the "functionEach" function and its returning value will be used as the delay (executed every loop for each
CB_GraphicSpritesobject).graphicSpritesObjectsarray <optional>
CB_GraphicSpritesScene#getGraphicSpritesAll()A numeric array containing the
CB_GraphicSpritesobjects that we want to loop. It should contain onlyCB_GraphicSpritesobjects which are already in the currentCB_GraphicSpritesSceneobject. If not provided, it will use all theCB_GraphicSpritesobjects contained in theCB_GraphicSpritesSceneobject.returnSetTimeoutsArrayboolean <optional>
false Defines whether we want the method to return an integer or a numeric array with information of each setTimeout call. Returning an array with information of each setTimeout call is only useful when the setTimeout function is called internally, which happens when the "delayBetweenEach" parameter is greater than 0 (zero).
delayBetweenEachAffectsFirstboolean <optional>
false If set to true, the desired delay (if any) will also affect the first call to the "functionEach" function.
functionFinishCB_Arrays.executeFunctionAll_ON_FINISH_CALLBACK <optional>
Function that will be called for when it has finished looping all the items. The first parameter will be the array which was looped, the second parameter will be the number of times that the "functionEach" callback was called (the most likely, matches the number of elements unless they are undefined or null), and the third parameter will be the maximum "delay" used, being "this" the array itself.
- Source:
- To Do:
-
- Think about only allowing
CB_GraphicSpritesobjects (in the "graphicSpritesObjects" parameter) which are already in theCB_GraphicSpritesScene(identify them by their ID), to avoid problems.
- Think about only allowing
Returns:
If the "returnSetTimeoutsArray" parameter is set to false, it will return the number of calls to the "functionEach" function that were performed (which should be the same number as the
CB_GraphicSpritesobjects given in the "graphicSpritesObjects" parameter). Otherwise, if the "returnSetTimeoutsArray" is set to true, it will return a numeric array with aCB_Arrays.executeFunctionAll_OBJECTobject for eachCB_GraphicSpritesgiven. The length of this array will also be the number of calls to the "functionEach" function that were performed. Note that if a value greater than 0 (zero) for the "delayBetweenEach" parameter has been provided, perhaps not all calls of the "functionEach" function will have been performed yet when exiting this method because of the asynchronous nature of the setTimeout function.- Type
- integer | array
-
forEach()
-
Alias for
CB_GraphicSpritesScene#executeFunctionAll. -
forEachGraphicSprites()
-
Alias for
CB_GraphicSpritesScene#executeFunctionAll. -
get()
-
Alias for
CB_GraphicSpritesScene#getGraphicSprites. -
getAll()
-
Alias for
CB_GraphicSpritesScene#getGraphicSpritesAll. -
getById()
-
Alias for
CB_GraphicSpritesScene#getGraphicSpritesById. -
getCopy( [avoidCopyingPointers] [, avoidCopyingTimes] [, clearReferences] [, filterProperties] [, propertiesToKeepObject]) → {CB_GraphicSpritesScene}
-
Gets a new copy of this object with the same attributes (all sub-objects will be a copy, they will not the same reference).
Parameters:
Name Type Argument Default Description avoidCopyingPointersboolean <optional>
false If set to true, it will not copy the
CB_GraphicSprites#pointerproperty of eachCB_GraphicSpritesobject.avoidCopyingTimesboolean <optional>
false If set to true, it will not copy neither the
CB_GraphicSprites#timeproperty of eachCB_GraphicSpritesobject nor the "time" property of each of their sprites (CB_GraphicSprites.SPRITE_OBJECTobjects).clearReferencesboolean <optional>
false If set to true, it will not copy neither the "container" nor the "parent" nor the "data.that" nor the "data.getThis" properties of any element. Useful to be able to stringify the object preventing the "TypeError: cyclic object value" error. When set to true, calls the
CB_GraphicSprites.clearReferencesfunction internally. If set to true and the "filterProperties" parameter is also set to true, theCB_GraphicSprites.filterPropertieswill always be called before calling theCB_GraphicSprites.clearReferencesfunction.filterPropertiesboolean <optional>
false If set to true, it will call the
CB_GraphicSprites.filterPropertiesfunction internally to filter the properties that we do not want to keep (using the given "propertiesToKeepObject" as the parameter to call it). When set to true, calls theCB_GraphicSprites.filterPropertiesfunction internally. If set to true and the "clearReferences" parameter is also set to true, theCB_GraphicSprites.filterPropertieswill always be called before calling theCB_GraphicSprites.clearReferencesfunction.propertiesToKeepObjectCB_GraphicSprites.filterProperties_propertiesToKeepObject_TYPE <optional>
CB_GraphicSprites.filterProperties_DEFAULT_PROPERTIES The object with the properties that we want to keep. Only used when the "filterProperties" parameter is set to true, as the "propertiesToKeepObject" when calling the
CB_GraphicSprites.filterPropertiesfunction internally.Returns:
Returns a copy of this object with the same attributes (all sub-objects will be a copy, not the same reference).
-
getGraphicSprites( [index] [, returnValueOnFail]) → {CB_GraphicSprites|*}
-
Gets a desired
CB_GraphicSpritesobject through its index (its position in theCB_GraphicSpritesScene#spritesGroups.itemsarray). Faster than getting it through its identifier with theCB_GraphicSpritesScene#getGraphicSpritesByIdmethod.Parameters:
Name Type Argument Default Description indexinteger <optional>
0 The index where the desired
CB_GraphicSpritesobject must be located (its position in theCB_GraphicSpritesScene#spritesGroups.itemsarray).returnValueOnFail* <optional>
The value we want it to return in the case that no value is found. If not provided, undefined will be returned.
Returns:
Returns a
CB_GraphicSpritesobject if found or the value of "returnValueOnFail" otherwise.- Type
- CB_GraphicSprites | *
-
getGraphicSpritesAll( [orderedByZIndex] [, returnValueOnFail]) → {array|*}
-
Gets all the sprites graphic objects (the "items" property of the internal
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject, if any).Parameters:
Name Type Argument Default Description orderedByZIndexboolean <optional>
false If set to true, it will return the
CB_GraphicSpritesobjects sorted by their z-index (ascending order).returnValueOnFail* <optional>
The value we want it to return in the case that no value is found. If not provided, undefined will be returned.
Returns:
Returns an array with all the
CB_GraphicSpritesobjects or the value of "returnValueOnFail" otherwise.- Type
- array | *
-
getGraphicSpritesById( [id] [, returnValueOnFail]) → {CB_GraphicSprites|*}
-
Gets a desired
CB_GraphicSpritesobject through its identifier. Slower than getting it through its index with theCB_GraphicSpritesScene#getGraphicSpritesmethod.Parameters:
Name Type Argument Description idstring | * <optional>
The identifier of the
CB_GraphicSpritesobject that we want to get.returnValueOnFail* <optional>
The value we want it to return in the case that no value is found. If not provided, undefined will be returned.
Returns:
Returns a
CB_GraphicSpritesobject if found or the value of "returnValueOnFail" otherwise.- Type
- CB_GraphicSprites | *
-
getGraphicSpritesIndexById( [id]) → {integer}
-
Gets the index (the position in the
CB_GraphicSpritesScene#spritesGroups.itemsarray) of a desiredCB_GraphicSpritesobject by its identifier.Parameters:
Name Type Argument Description idstring | * <optional>
The identifier of the
CB_GraphicSpritesobject whose index we want to get.- Source:
- To Do:
-
- Optimize it (perhaps using a cache matching the IDs with their position, maybe using the "position" or "positionByZIndex" properties).
Returns:
Returns the index (the position in the
CB_GraphicSpritesScene#spritesGroups.itemsarray) of the desiredCB_GraphicSpritesobject or -1 if not found.- Type
- integer
-
getIndexById()
-
getSpritesGroups( [returnValueOnFail]) → {CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT|*}
-
Gets the sprites groups object (the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject which is in theCB_GraphicSpritesScene#spritesGroupsproperty), if any.Parameters:
Name Type Argument Description returnValueOnFail* <optional>
The value we want it to return in the case that no value is found. If not provided, undefined will be returned.
Returns:
Returns the sprites groups object (the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject which is in theCB_GraphicSpritesScene#spritesGroupsproperty), if any, or the value of "returnValueOnFail" otherwise. -
getSpritesGroupsAll()
-
Alias for
CB_GraphicSpritesScene#getSpritesGroups. -
insert()
-
Alias for
CB_GraphicSpritesScene#insertSpritesGroup. -
insertSpritesGroup( [spritesGroup] [, avoidUpdatingGraphicSpritesByZIndex] [, byReference]) → {CB_GraphicSpritesScene.insertSpritesGroup_OBJECT}
-
Adds the desired group of graphic sprites. Creates internal
CB_GraphicSpritesobjects.Parameters:
Name Type Argument Default Description spritesGroupCB_GraphicSprites.SPRITES_OBJECT <optional>
Object with the desired sprites group. It will be stored in the "
CB_GraphicSpritesScene#spritesGroups.spritesGroups" property and theCB_GraphicSpritesobject created internally will be stored in the "CB_GraphicSpritesScene#spritesGroups.items" property.avoidUpdatingGraphicSpritesByZIndexboolean <optional>
false If set to true, it will not call the {CB_GraphicSpritesScene#updateGraphicSpritesByZIndex} method internally. Internal usage recommended only.
byReferenceboolean <optional>
false This value will be used as the "byReference" parameter of the constructor when creating the new internal
CB_GraphicSpritesobjects.Returns:
Returns an object whose "spritesGroup" property contains the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTwhich has been inserted (it could have been modified/sanitized from the given one and some missing properties or those which were wrong could have been inherited) and was used to create the internalCB_GraphicSpritesobject when calling its constructor and the "item" property contains theCB_GraphicSpritesobject created and inserted. -
insertSpritesGroups( [spritesGroups] [, byReference]) → {CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT}
-
Adds the desired groups of graphic sprites. Calls the
CB_GraphicSpritesScene#insertSpritesGroupandCB_GraphicSpritesScene#updateGraphicSpritesByZIndexmethods internally.Parameters:
Name Type Argument Default Description spritesGroupsCB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT <optional>
Object with the desired sprites groups. They will be stored in the "
CB_GraphicSpritesScene#spritesGroups.spritesGroups" property and theCB_GraphicSpritesobjects created internally will be stored in the "CB_GraphicSpritesScene#spritesGroups.items" property.byReferenceboolean <optional>
!! CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT.byReference_DEFAULTThis value will be used as the "byReference" parameter of the constructor when creating the new internal
CB_GraphicSpritesobjects. If a boolean value is not provided, it will use the value of theCB_GraphicSpritesScene.SPRITES_GROUPS_OBJECT.byReference_DEFAULTproperty of the givenCB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject (parsed to boolean).Returns:
Returns the
CB_GraphicSpritesScene#spritesGroupsproperty after updating it. -
remove()
-
Alias for
CB_GraphicSpritesScene#removeSpritesGroup. -
removeAll()
-
Alias for
CB_GraphicSpritesScene#removeSpritesGroups. -
removeById()
-
removeGraphicSprites()
-
Alias for
CB_GraphicSpritesScene#removeSpritesGroup. -
removeGraphicSpritesById()
-
removeSpritesGroup( [index]) → {boolean}
-
Removes a sprites group and its
CB_GraphicSpritesobject by its index (its position in theCB_GraphicSpritesScene#spritesGroups.itemsarray). Calls theCB_GraphicSpritesScene#updateGraphicSpritesByZIndexmethod internally.Parameters:
Name Type Argument Default Description indexinteger <optional>
0 The index where the
CB_GraphicSpritesobject is located (its position in theCB_GraphicSpritesScene#spritesGroups.itemsarray).Returns:
Returns true if the
CB_GraphicSpritesobject has been deleted from the graphic sprites scene object or false otherwise.- Type
- boolean
-
removeSpritesGroupById( [id]) → {boolean}
-
Removes a sprites group and its
CB_GraphicSpritesobject by its identifier. Calls theCB_GraphicSpritesScene#updateGraphicSpritesByZIndexmethod internally.Parameters:
Name Type Argument Description idstring | * <optional>
The identifier of the
CB_GraphicSpritesobject.- Source:
- To Do:
-
- Optimize it (perhaps using a cache matching the IDs with their position, maybe using the "position" or "positionByZIndex" properties).
Returns:
Returns true if the
CB_GraphicSpritesobject has been deleted from the graphic sprites scene object or false otherwise.- Type
- boolean
-
removeSpritesGroups()
-
Removes all the sprites groups (and all the
CB_GraphicSpritesobjects) by clearing theCB_GraphicSprites#spritesGroupsproperty. -
removeSpritesGroupsAll()
-
Alias for
CB_GraphicSpritesScene#removeSpritesGroups. -
setPropertyCascade(propertyName [, value] [, onlyCurrent]) → {integer}
-
Sets the desired value of a given property name to the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject as well to itsCB_GraphicSpritesobjects and their children (theirCB_GraphicSprites.SPRITES_OBJECTobject, including theirCB_GraphicSprites.SPRITE_OBJECTand theirCB_GraphicSprites.SUBSPRITE_OBJECTobjects). Calls theCB_GraphicSprites#setPropertyCascademethod internally.Parameters:
Name Type Argument Default Description propertyNamenumber The name of the property we want to affect. Also used as the "propertyName" parameter when calling the
CB_GraphicSprites#setPropertyCascademethod internally.value* <optional>
The value desired for the given property. Also used as the "value" parameter when calling the
CB_GraphicSprites#setPropertyCascademethod internally.onlyCurrentboolean <optional>
false If set to true, it will only affect the current sprite and its sub-sprites of each
CB_GraphicSpritesobject (and also theCB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject and theCB_GraphicSprites.SPRITES_OBJECTobject of eachCB_GraphicSpritesobject). Used as the "propertyName" parameter when calling theCB_GraphicSprites#setPropertyCascademethod internally.Returns:
Returns the number of elements affected (counting the
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTobject and theCB_GraphicSprites.SPRITES_OBJECTobjects).- Type
- integer
-
updateGraphicSpritesByZIndex() → {array}
-
Updates (sorts again) the "itemsByZIndex" property (which is an array with the
CB_GraphicSpritesobjects ordered by z-index, whose data comes from the array in the "items" property of theCB_GraphicSpritesScene#spritesGroupsobject) of theCB_GraphicSpritesScene#spritesGroupsobject.Returns:
Returns the "itemsByZIndex" array of the
CB_GraphicSpritesScene#spritesGroupsobject after updating it. Returns null if the property could not be obtained or updated.- Type
- array
-
updateItemsByZIndex()
Type Definitions
-
SPRITES_GROUPS_OBJECT
-
An object with the information that belongs to a group of graphic sprites.
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description idstring | * <optional>
'CB_GraphicSpritesScene_' + CB_GraphicSpritesScene._idUnique++ Identifier of the sprites groups object and also for the graphic sprites scene (also used as the
CB_GraphicSprites.idproperty for theCB_GraphicSpritesSceneobject). It should be unique. Recommended. It must be a value which evaluates to true. By default, it is generated automatically (with an internal counter).src* <optional>
"" The value for the "src" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.srcTypestring <optional>
CB_GraphicSprites.SRC_TYPES_DEFAULTThe value for the "srcType" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects. It should point to a property of theCB_GraphicSprites.SRC_TYPESobject. You can use other values of theCB_GraphicSprites.SRC_TYPESobject or create new ones.srcLeftnumber <optional>
CB_GraphicSprites.LEFT_SOURCE_DEFAULTThe value for the "srcLeft" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.srcTopnumber <optional>
CB_GraphicSprites.TOP_SOURCE_DEFAULTThe value for the "srcTop" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.srcWidthnumber <optional>
CB_GraphicSprites.WIDTH_SOURCE_DEFAULTThe value for the "srcWidth" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.srcHeightnumber <optional>
CB_GraphicSprites.HEIGHT_SOURCE_DEFAULTThe value for the "srcHeight" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.leftnumber <optional>
CB_GraphicSprites.LEFT_DEFAULTThe value for the "left" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.topnumber <optional>
CB_GraphicSprites.TOP_DEFAULTThe value for the "top" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.widthnumber <optional>
CB_GraphicSprites.WIDTH_DEFAULTThe value for the "width" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.heightnumber <optional>
CB_GraphicSprites.HEIGHT_DEFAULTThe value for the "height" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.zIndexnumber <optional>
CB_GraphicSprites.ZINDEX_DEFAULTThe value for the "zIndex" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.disabledboolean <optional>
false The value for the "disabled" property which will be used as default if not provided (or the provided one was wrong) in the given
CB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.dataobject <optional>
{ 'that' : CB_GraphicSprites.SPRITES_GROUPS_OBJECT, 'getThis' = function() { return this.that; } } Object with any additional data desired which can be any kind. It will always have a "that" property pointing to the
CB_GraphicSprites.SPRITES_GROUPS_OBJECTobject where it belongs to and a function in its "getThis" property returning the same value (added automatically). These properties ("that" and "getThis") cannot be overridden. The value given will also be used for the "data" property which will be used as default if not provided (or the provided one was wrong) in the givenCB_GraphicSprites.SPRITES_OBJECTobjects (in the "spritesGroups" property), when creating the internalCB_GraphicSpritesobjects.spritesGroupsarray <optional>
[] Numeric array containing
CB_GraphicSprites.SPRITES_OBJECTobjects with all the sprites groups that are useful for creating the internalCB_GraphicSpritesobjects. Recommended at least to provide oneCB_GraphicSprites.SPRITES_OBJECTobject in the first index.parent* <optional>
Property pointing to or containing its parent (also used as the
CB_GraphicSpritesScene.parentproperty for theCB_GraphicSpritesSceneobject).itemsarray Read-only numeric array containing
CB_GraphicSpritesobjects created internally. Their "parent" property will be set to point the currentCB_GraphicSpritesSceneobject which contains them.itemsByZIndexarray Read-only property containing a numeric array of all the
CB_GraphicSpritesobjects ordered by their z-index ("zIndex" property). It is updated automatically when the z-index of a sprite is set with itsCB_GraphicSprites#setZIndexmethod or when inserting/removingCB_GraphicSpritesobjects through theCB_GraphicSpritesScene#insertSpritesGroups,CB_GraphicSpritesScene#insertSpritesGroup,CB_GraphicSpritesScene#removeSpritesGrouporCB_GraphicSpritesScene#removeSpritesGroupByIdmethods.byReference_DEFAULTboolean <optional>
false Default value to use as the "byReference" parameter for the constructor and for the
CB_GraphicSpritesScene#insertSpritesGroupsmethod. If a boolean value is not provided, it will be parsed to boolean (resulting undefined to be false).containerCB_GraphicSpritesScene Read-only property pointing to the
CB_GraphicSpritesSceneobject which contains it.isSpritesGroupsboolean Read-only property which is always set to true to help identify this type of object.
type'spritesGroups' Read-only property indicating the type of object (always "spritesGroups").
Example
{ //'my_sprites_scene_1': id: "my_sprites_scene_1", srcType: CB_GraphicSprites.SRC_TYPES.IMAGE, srcLeft: 10, srcTop: 20, srcWidth: 64, srcHeight: 32, left: 10, top: 20, width: 64, height: 32, data: { datum_1: "value_1", datum_2: 2, datum_3: [ "a", "b", "c" ] }, //Sprites groups: spritesGroups: [ //'my_sprites_1': { id: "my_sprites_1", src: "path/to/image.gif", sprites: [ //'my_sprite_1': { id: "my_sprite_1", subSprites: [ //'my_subsprite_1': { id: "my_subsprite_1", srcLeft: 10, srcTop: 20, zIndex: 1 }, //'my_subsprite_2': { id: "my_subsprite_2", srcLeft: 20, srcTop: 40, zIndex: 2 } ] }, //'my_sprite_2': { id: "my_sprite_2", subSprites: [ //'my_subsprite_3': { id: "my_subsprite_3", srcLeft: 30, srcTop: 60, zIndex: 1 }, //'my_subsprite_4': { id: "my_subsprite_4", srcLeft: 40, srcTop: 80, zIndex: 2 } ] } ] }, //'my_sprites_2': { id: "my_sprites_2", src: "path/to/image2.gif", sprites: [ //'my_sprite_3': { id: "my_sprite_3", subSprites: [ //'my_subsprite_1': { id: "my_subsprite_5", srcLeft: 10, srcTop: 20, zIndex: 1 }, //'my_subsprite_2': { id: "my_subsprite_6", srcLeft: 20, srcTop: 40, zIndex: 2 } ] }, //'my_sprite_4': { id: "my_sprite_4", subSprites: [ //'my_subsprite_3': { id: "my_subsprite_7", srcLeft: 30, srcTop: 60, zIndex: 1 }, //'my_subsprite_4': { id: "my_subsprite_8", srcLeft: 40, srcTop: 80, zIndex: 2 } ] } ] } ] } -
insertSpritesGroup_OBJECT
-
Object used as the returning value of the
CB_GraphicSpritesScene#insertSpritesGroupmethod.Type:
- Object
- Source:
Properties:
Name Type Description spritesGroupCB_GraphicSprites.SPRITES_OBJECT The
CB_GraphicSpritesScene.SPRITES_GROUPS_OBJECTwhich has been inserted (it could have been modified/sanitized from the given one and some missing properties or those which were wrong could have been inherited) and was used to create the internalCB_GraphicSpritesobject when calling its constructor.itemCB_GraphicSprites The
CB_GraphicSpritesobject created and inserted from theCB_GraphicSprites.SPRITES_OBJECT.