Groups

Groups

Methods


add_to_group(object, group)


Adds the given object to the front of the group.

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

Parameters:
Name Type Description
object

object that gets added to the group

group

group that the object is getting added to

Code Equivalent:
group.add(newItem);

add_to_world(object)

Parameters:
Name Type Description
object

object to add to the group

Code Equivalent:
game.world.add(object);

Blockly.JavaScript['call_function_on_group'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['create_object_in_group_with_frame'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

Blockly.JavaScript['group_get_first_alive_dead'](block)

Parameters:
Name Type Description
block
Code Equivalent:
undefined

create_group()


Creates a container to hold multiple sprites. Assign to a variable for future use.

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

Code Equivalent:
game.add.group()

create_object_in_group(x, y, tag)


Creates an object at a position with the given tag, and adds it to the front of the group.

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

Parameters:
Name Type Description
x Number

the x coordinate to display the new object at, relative to the position of the group

y Number

the y coordinate to display the new object at, relative to the position of the group

tag String

the tag of the image to assign to the object

Code Equivalent:
group.create(x, y, tag)

create_object_in_group_with_frame(x, y, frame, tag, group)


Creates a new object from the tag and adds it to the front of the group. Assign to a variable for future use.

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

Parameters:
Name Type Description
x Number

the x position for the object to be displayed at

y Number

the y position for the object to be displayed at

frame Number

the frame of the sprite sheet to display at the start

tag String

the sprite to display on the object

group

the group to add the object to

Code Equivalent:
group.create(xPos, yPos, tag, frame)

destroy_group(group, handleChildren)


Removes all objects and deletes the group, with the option to delete the objects as well.

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

Parameters:
Name Type Description
group

group to destroy

handleChildren

option to delete all containing objects

Code Equivalent:
group.destroy(handleChildren);

group_contains(group, object)


Figures out if the group contains the object, and returns true or false.

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

Parameters:
Name Type Description
group

group to check

object

object to check

Code Equivalent:
group.contains(child)

group_count_alive_dead(group, state)


Figures out how many objects are alive or fainted in the group, and returns the number.

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

Parameters:
Name Type Description
group

group to check

state

determines if you are checking alive or fainted.

Code Equivalent:
group.countstate()

group_get_all(group)


Returns all objects in the group, to make changes or get information from them all at the same time.

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

Parameters:
Name Type Description
group

group to get all objects from

Code Equivalent:
group.getAll()

group_get_at(group, index)


Returns the object at the position of the given index in the group.

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

Parameters:
Name Type Description
group

group to get the object from

index Number

position of the object in the group

Code Equivalent:
group.getAt(index)

group_get_closest_to(group, object)


Returns the object in the group physically closest to the given object, based on their x/y coordinates.

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

Parameters:
Name Type Description
group

group to get the object from

object

object to base the position from

Code Equivalent:
group.getClosestTo(object)

group_get_first_alive_fainted(group, mode)


Returns the first object closest to the front of the group that is alive/fainted.

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

Parameters:
Name Type Description
group

group to get the object from

mode

determines if you are checking for an alive or fainted object

Code Equivalent:
group.getFirstmode()

group_get_random(group)


Returns a randomly chosen object from the group.

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

Parameters:
Name Type Description
group

group to get the object from

Code Equivalent:
group.getRandom()

group_get_random_exists(group)


Returns a randomly chosen object from the group that has exists set to true.

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

Parameters:
Name Type Description
group

group to get the object from

Code Equivalent:
group.getRandomExists()

group_remove_all(group, deleteObjects)


Remove all members from the group, with the option to delete them as well.

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

Parameters:
Name Type Description
group

group to remove the objects from

deleteObjects Boolean

option to delete the objects after removing them from the group

Code Equivalent:
group.removeAll(deleteObjects);

remove_from_group(object, group, destroy)


Removes the given object from the group, with the option to remove it from the game as well.

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

Parameters:
Name Type Description
object

object that gets removed from the group

group

group that the object is getting removed from

destroy Boolean

option to remove the object from the game

Code Equivalent:
group.remove(child, destroy);