Features for all objects

Common features that can be used for all objects in GDevelop. Read more explanations about it.

Actions

Pick a random object
Pick one object from all the specified objects. When an object is picked, the next conditions and actions of this event work only on that object.

Pick all instances
Pick all instances of the specified object(s). When you pick all instances, the next conditions and actions of this event work on all of them.

Create an object
Create an object at specified position

Create an object from its name
Among the objects of the specified group, this action will create the object with the specified name.

Apply movement to all objects
Moves all objects according to the forces they have. GDevelop calls this action at the end of the events by default.

Conditions

Pick a random object
Pick one object from all the specified objects. When an object is picked, the next conditions and actions of this event work only on that object.

Pick all objects
Pick all the specified objects. When you pick all objects, the next conditions and actions of this event work on all of them.

Collision
Test the collision between two objects using their collision masks.
Note that some objects may not have collision masks. Some others, like Sprite objects, also provide more precise collision conditions.

Distance between two objects
Compare the distance between two objects.
If condition is inverted, only objects that have a distance greater than specified to any other object will be picked.

An object is turned toward another
Check if an object is turned toward another

Number of objects
Count how many of the specified objects are currently picked, and compare that number to a value. If previous conditions on the objects have not been used, this condition counts how many of these objects exist in the current scene.

Pick nearest object
Pick the object of this type that is nearest to the specified position. If the condition is inverted, the object farthest from the specified position is picked instead.

Raycast
Sends a ray from the given source position and angle, intersecting the closest object.
The instersected object will become the only one taken into account. If the condition is inverted, the object to be intersected will be the farthest one within the ray radius.

Raycast to position
Sends a ray from the given source position to the final point, intersecting the closest object.
The instersected object will become the only one taken into account. If the condition is inverted, the object to be intersected will be the farthest one within the ray radius.

An object is moving toward another
Check if an object moves toward another.
The first object must move.

The cursor/touch is on an object
Test if the cursor is over an object, or if the object is being touched.

Expressions

Expression Description
Count(object) Count the number of the specified objects being currently picked in the event
object Object

Object actions

De/activate a behavior
De/activate the behavior for the object.

Add a force (angle)
Add a force to an object. The object will move according to all of the forces it has. This action creates the force using the specified angle and length.

Add a force to move toward an object
Add a force to an object to make it move toward another.

Add a force to move toward a position
Add a force to an object to make it move toward a position.

Add a force
Add a force to an object. The object will move according to all of the forces it has.

Stop the object
Stop the object by deleting all of its forces.

Hide
Hide the specified object.

Layer
Move the object to a different layer.

Z order
Modify the Z-order of an object

Delete an object
Delete the specified object.

Put an object around another
Position an object around another, with the specified angle and distance. The center of the objects are used for positioning them.

Put an object around a position
Position the center of the given object around a position, using the specified angle and distance.

X position of an object
Change the X position of an object.

Position of an object
Change the position of an object.

Y position of an object
Change the Y position of an object.

Value of an object variable
Change the value of an object variable.

Text of an object variable
Change the text of an object variable.

Show
Show the specified object

Clear variable
Remove all the children from the object variable.

Append variable to an object array
Appends a variable to the end of an object array variable.

Append a boolean to an object array
Appends a boolean to the end of an object array variable.

Append a number to an object array
Appends a number to the end of an object array variable.

Append a string to an object array
Appends a string to the end of an object array variable.

Remove variable from an object array (by index)
Removes a variable at the specified index of an object array variable.

Remove a child
Remove a child from an object variable.

Pause a timer
Pause a timer.

Delete a timer
Delete a timer from memory.

Start (or reset) a timer
Reset the specified timer, if the timer doesn't exist it's created and started.

Rotate
Rotate an object, clockwise if the speed is positive, counterclockwise otherwise.

Rotate toward angle
Rotate an object towards an angle with the specified speed.

Rotate toward position
Rotate an object towards a position, with the specified speed.

Separate two objects
Move an object away from another using their collision masks.
Be sure to call this action on a reasonable number of objects to avoid slowing down the game.

Angle
Change the angle of rotation of an object.

Boolean value of an object variable
Change the boolean value of an object variable.

Toggle the boolean value of an object variable
Toggles the boolean value of an object variable.
If it was true, it will become false, and if it was false it will become true.

Unpause a timer
Unpause a timer.

Object conditions

Angle
Compare the angle of the specified object.

Angle of movement
Compare the angle of displacement of an object

Object is stopped
Check if an object is not moving

Behavior activated
Check if the behavior is activated for the object.

Point inside object
Test if a point is inside the object collision masks.

Compare layer
Check if the object is on the specified layer.

Value of a timer
Test the elapsed time of a timer.

Timer paused
Test if specified timer is paused.

Boolean value of an object variable
Compare the boolean value of an object variable.

Child existence
Check if the specified child of the variable exists.

Compare Z order
Compare the Z-order of the specified object.

Compare X position of an object
Compare the X position of the object.

Compare Y position of an object
Compare the Y position of an object.

Value of an object variable
Compare the value of an object variable.

Text of an object variable
Compare the text of an object variable.

Visibility of an object
Check if an object is visible.

Speed
Compare the overall speed of an object

Object expressions

Expression Description
Object.Angle() Current angle, in degrees, of the object
Object.AngleToObject(object) Compute the angle between two objects. If you need the angle to an arbitrary position, use AngleToPosition.
object Object
Object.AngleToPosition(number, number) Compute the angle between the object center and a “target” position. If you need the angle between two objects, use AngleToObject.
number Target X position
number Target Y position
Object.Distance(object) Distance between two objects
object Object
Object.DistanceToPosition(number, number) Distance between an object and a position
number Target X position
number Target Y position
Object.ForceAngle() Average angle of the forces
Object.ForceLength() Average length of the forces
Object.ForceX() Average X coordinates of forces
Object.ForceY() Average Y coordinates of forces
Object.Height() Height of the object
Object.Layer() Return the name of the layer the object is on
Object.ObjectName() Return the name of the object
Object.ObjectTimerElapsedTime(string) Value of a timer
string Timer's name
Object.SqDistance(object) Square distance between two objects
object Object
Object.SqDistanceToPosition(number, number) Square distance between an object and a position
number Target X position
number Target Y position
Object.Variable(objectvar) Value of an object variable
objectvar Variable
Object.VariableChildCount(objectvar) Number of children of an object variable
objectvar Variable
Object.VariableString(objectvar) Text of an object variable
objectvar Variable
Object.Width() Width of the object
Object.X() X position of the object
Object.Y() Y position of the object
Object.ZOrder() Z order of an object

This page is an auto-generated reference page about the Features for all objects feature of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop features here.