Sprite/Image

Sprite/Image

Methods


add_animation(object, name, frames, fps, loop)

Parameters:
Name Type Description
object Sprite

sprite to apply the animation to

name String

name of the tag for the animation

frames

array of numbers or strings that correspond to frames to add to the animation

fps Number

the speed the animation should play

loop Boolean

whether or not the animation should loop or play once

Code Equivalent:
variable_object.animations.add('text_name', value_frames, number_fps, checkbox_loop);

add_child(object, child)

Parameters:
Name Type Description
object

the object to add a child to

child

the child to add to the object

Code Equivalent:
variable_object.addChild(value_child);

add_child(object, child)

Parameters:
Name Type Description
object

the object to add a child to

child

the child to add to the object

Code Equivalent:
variable_object.addChild(value_child);

add_child_at(object, child, index)


Adds a child to the given object at the given index.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

the object to add a child to

child

the child to add to the object

index Number

the index to add the child to

Code Equivalent:
object.addChildAt(child, index);

add_child_at(object, child, index)

Parameters:
Name Type Description
object

the object to add a child to

child

the child to add to the object

index Number

the index to add the child to

Code Equivalent:
variable_object.addChildAt(value_child, value_index);

add_image(x, y, tag)

Parameters:
Name Type Description
x Number

x position of the sprite

y Number

y position of the sprite

tag String

the tag of the image to use for the sprite

Code Equivalent:
game.add.sprite(x_pos, y_pos, tag)

addspritewithatlas(tag, source, xml)

Parameters:
Name Type Description
tag String

the tag that defines the image

source String

the file path of the image

xml String

the file path of the xml file

Code Equivalent:
game.load.atlasXML(value_tag, value_text_source, value_text_xmlsource)

align_in(object, container, position, offset_x, offset_y)

Parameters:
Name Type Description
object

object to align

container

object to align to

position Number

position to justify the alignment to

offset_x Number

horizontal adjustment of the alignment

offset_y Number

vertical adjustment of the alignment

Code Equivalent:
object.alignIn(container, Phaser.dropdown_position, offset_x, offset_y);

align_to(object, container, position, offset_x, offset_y)

Parameters:
Name Type Description
object

object to align

container

object to align to

position Number

position to justify the alignment to

offset_x Number

horizontal adjustment of the alignment

offset_y Number

vertical adjustment of the alignment

Code Equivalent:
object.alignTo(container, Phaser.dropdown_position, offset_x, offset_y);

Blockly.JavaScript['remove_child'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['remove_child_at'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['remove_children'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['set_child_index'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['set_texture'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

bring_to_top(object)

Parameters:
Name Type Description
object

object to render

Code Equivalent:
value_object.bringToTop();

check_world_bounds(object, bool)


If true, the game checks every frame to see if an object is within the world bounds, and returns a boolean with the result.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to check

bool Boolean

enables/disables checking world bounds

Code Equivalent:
value_object.checkWorldBounds = value_bool;

clear_cropping(object)

Parameters:
Name Type Description
object

object whose image is cropped

Code Equivalent:
value_object.crop();

clear_scale_min_max(object)


Clears all scale constraints set on the object.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to clear scale constraints from

Code Equivalent:
value_object.setScaleMinMax();

contains(object, child)

Parameters:
Name Type Description
object

object to check

child

child to check

Code Equivalent:
object.contains(value_child)

contains(object, child)

Parameters:
Name Type Description
object

object to check

child

child to check

Code Equivalent:
variable_object.contains(value_child)

create_image(tag, source)

Parameters:
Name Type Description
tag String

the tag that defines the image

source String

the file path of the image

Code Equivalent:
game.load.image(tag, source);

create_sprite_sheet(tag, source, width, height)

Parameters:
Name Type Description
tag String

the tag that defines the image

source String

the file path of the image

width Number

the width of each frame

height Number

the height of each frame

Code Equivalent:
game.load.spritesheet(tag, source, number_frame_width, number_frame_height);

crop(object, rectangle)


Crop the image of an object to the given rectangular bounds.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object whose image is getting cropped

rectangle Phaser.Rectangle

the rectangle bounds and properites to use for the crop

Code Equivalent:
value_object.crop(value_rectangle);

destroy_sprite(object, bool)

Parameters:
Name Type Description
object

object to destroy

bool Boolean

whether or not the sprite's children should also be destroyed

Code Equivalent:
value_object.destroy(value_bool);

get_child_at(object, index)

Parameters:
Name Type Description
object

object to get the child from

index Number

index the child is located at

Code Equivalent:
object.getChildAt(value_index)

get_child_at(object, index)

Parameters:
Name Type Description
object

object to retrieve the child from

index Number

index the child is located at

Code Equivalent:
variable_object.getChildAt(value_index)

get_child_index(object, child)

Parameters:
Name Type Description
object

object to get the child from

child

child to get the index from

Code Equivalent:
variable_object.getChildIndex(value_child)

get_child_index(object, child)

Parameters:
Name Type Description
object

object to get the child from

child

child to get the index from

Code Equivalent:
object.getChildIndex(child)

imagesubtextureatlas(x, y, tag, id)

Parameters:
Name Type Description
x Number

x position of the sprite

y Number

y position of the sprite

tag String

the tag of the image to use for the sprite

id String

the id of the xml texture to use for the sprite

Code Equivalent:
game.add.sprite(value_x, value_y, value_spritesource, value_xmlsubtexture )

load_texture(object, tag)

Parameters:
Name Type Description
object

object whose image is getting changed

tag String

the tag of the texture to change the image to

Code Equivalent:
value_object.loadTexture(value_texture);

move_down(object)


Moves the object down one layer in the display list.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to render

Code Equivalent:
value_object.moveDown();

move_up(object)


Moves the object up one layer in the display list.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to render

Code Equivalent:
value_object.moveUp();

out_of_bounds_faint(object, boolean)


If true, the object gets deleted if it leaves the world bounds.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object that gets deleted

boolean Boolean

sets the action to true or false

Code Equivalent:
value_object.outOfBoundsFaint = value_bool;

out_of_bounds_kill ()

Code Equivalent:
undefined

remove_child(object, child)

Parameters:
Name Type Description
object

object to remove the child from

child

child to remove from the object

Code Equivalent:
object.removeChild(child);

remove_child_at(object, index)


Removes the child at the given index from the object.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to remove the child from

index

index of the child to remove from the object

Code Equivalent:
object.removeChildAt(value_index);

remove_children()

Code Equivalent:
object.removeChildren();

reset_frame(object)

Parameters:
Name Type Description
object

object to reset

Code Equivalent:
value_object.resetFrame();

resize_frame()

Parameters:
Type Description
Code Equivalent:
value_object.resetFrame(value_parent, value_width, value_height);

send_to_back(object)

Parameters:
Name Type Description
object

object to render

Code Equivalent:
game.world.sendToBack(variable_object);

set_child_index(object, child, index)


Sets the position of the child in the object's list of children.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object that contains the child

child

child to change the position of

index Number

index to set the child's position to

Code Equivalent:
object.setChildIndex(child, index);

set_scale_min_max(object, minX, minY, maxX, maxY)


Sets the limits for how the object will scale based on it's parent.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to set the scale constraints for

minX Number

the minimum horizontal scale the Game Object can scale down to

minY Number

the minimum vertical scale the Game Object can scale down to

maxX Number

the maximum horizontal scale the Game Object can scale down to

maxY Number

the maximum vertical scale the Game Object can scale down to

Code Equivalent:
value_object.setScaleMinMax(minX, minY, maxX, maxY);

set_sprite_frame(object, frame)


Sets the texture frame for the object to use for rendering.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
object

object to set the frame for

frame

frame to set the texture to

Code Equivalent:
value_object.setFrame(value_frame);

sprite_overlap ()

Code Equivalent:
undefined

swap_children(parent, child, child2)


Swaps the position of the two children in the object's list.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
parent

parent of the children who are being swapped

child

to be swapped with child2

child2

to be swapped with cihld

Code Equivalent:
value_parent.swapChildren(value_child, value_child2);