Skip to content

add()

Add an object to a collection.

If x and y are specified, the object is added at that position. Otherwise, it uses its current position.

If the object is already in another collection, it is removed from there first.

Parameters

Once an object collection has been created, you can use the following functions:

collection.add(item)
collection.add(item, x, y)
Parameter Type Default Description
item Drawable required The object to add.
x int or float None The horizontal position, in pixels. Defaults to the object's current position.
y int or float None The vertical position, in pixels. Defaults to the object's current position.