Sprite object

Sprite objects are the most often used objects in GDevelop.

A sprite object allows us to display an image or to play a series of images as an animation. It can be used for many things in our games like buttons, characters or platforms. Anything that can be represented with an image can be a sprite object.

Creating a sprite object

In order to add a sprite to your scene, select the “Click to add an object” option located on the right at the bottom of the Objects list.

A new panel will open that will show the different types of objects available in GDevelop.

Choose “Sprite” from the list to create a new sprite object in your game scene.

This selection will open up the object properties window. In this window, you will see a few properties of the sprite object.

Adding an animation

An animation allows you to add an image or series of images to the sprite object. To add an animation, click the add animation button.

This will expand the current dialog box and show you a wide variety of options you can tweak.

Adding an image to the animation

We can add images to the animation of our object by clicking on the plus symbol.

This will open the file explorer so that you can browse through the files and choose a suitable image for your animation. After choosing the image, you will see the image being displayed in the window.

Adding multiple animations

An object might sometimes require to have more than one animations. To add animations, click the “Add animation” button in the same way that we did it the first time. This feature allows us to easily separate the different animations.

Later, we can switch between the animations using events.

Naming the animation

At the top of the animation section in the window, you will see a field beside “Animation #” with grayed out “Optional animation name” written in it. To enter a name for your animation, click on the field and enter the name.

In objects with multiple animations, you may find it difficult to differentiate between animations without names. It is generally a good practice to use animation name for objects with multiple animations.

If we don't enter a name we need to use the animation number to refer to this animation.

Adding multiple images in an animation

To add multiple images to an animation, you can select all the images from the explorer and add them to the animation.

Images will be played in the same order as displayed.

Repeating the animation

By default, every animation plays only once, which means that the animation stops as soon as its last frame finishes. To repeat the animation, we can “loop” the animation. We can set the animation to “loop” by clicking the repeat icon.

Once an animation is set to loop, it is going to play continuously.

Setting animation time

The speed of the animation can be set by changing the value by the clock icon.

The value entered in the field is the time elapsed between two consecutive frames. The default value is 0.08 seconds. For faster playback use lower animation time while, for slower playback, use high animation time

Naming the object

At the top of the dialog, you can see the name of the object in the “Object Name” field. The name of the object usually describes the content of an object which makes it easy to distinguish from other sprites.

Adding object to the scene

To add the sprite object to our scene just select it and click in the scene to add an instance of the object to our scene.

Your new sprite is now complete, but you still need to add it to your game scene. Click on the new sprite in the Object list. Next, click on the scene where you want to add the sprite. You will now see your sprite added to the scene. You can add multiple “instances” of your sprite to your game screen. Simply repeat the process for adding the first sprite.

Using multiple animations with events

After creating multiple animations, each with their own unique set of images, you can use events to switch between animations. Setting the animation time between 0 - 1 will ensure it stays active when using events.

Using a negative animation time disables the event actions.

Do not use negative values.

When you have set multiple animations for an object, you can use the events tab to “Change the animation (by name)”. This is controlled in the “Add action” section of the condition. It will allow you to switch to the correct animation whenever the condition used in the “Add condition” section is true.

As advised before, use animation names for multiple animations in an object to easily differentiate between them.

To add an action to change animation using animation name, choose the “Change the animation (by name)” condition.

Then put that name within the “Animation name” field surrounded by quotes.

For more event details, follow the tutorials here.

Edit Points

Below all the animations, there is an EDIT POINTS option.

Clicking on this option opens up a new dialog, in which, coordinates for the origin and the center of the sprite are already filled.

You can add points using the + symbol in the bottom right of the dialog. These points can be used as references for different actions. You can see an example here. You can add different points to different animations and/or different sprites by disabling the below options.


See it in action! 🎮
Click on the images to open the examples online.