Skip to content

11. Visual Effects

Series

You are reading Part 11 of the Space Shooter Tutorial.

  1. Space Shooter, Part 1
  2. Space Shooter, Part 2
  3. Space Shooter, Part 3
  4. Space Shooter, Part 4
  5. Space Shooter, Part 5
  6. Space Shooter, Part 6
  7. Space Shooter, Part 7
  8. Space Shooter, Part 8
  9. Space Shooter, Part 9
  10. Space Shooter, Part 10
  11. Space Shooter, Part 11
  12. Space Shooter, Part 12
  13. Space Shooter, Part 13

Tip

In this chapter, we will learn how to add visual effects to our game objects.

We will use a blinking effect for the player when the player gets damaged. In GDevelop, there is a behavior for blinking, so go to the player's behavior settings. Then search "blink" to install the action called Flash.

Add this behavior to the player. You should see the behavior in the player's tab.

Open the Events tab, and find the event related to damaging the player. Add a new action, select the Player as an object, and choose Flash(blink). Enter 1 second for the duration of the blinking.

Importing explosion effects

We will use a sample project of GDevelop to copy an explosion effect and put it in our game. Go to File and Create a new project.

Select Particle Effects Demo.

Tip

You can run the game and check these great particle effects.

We will copy three objects (BasicExplosion, BasicExplosionSmooth, and BasicExplosionSharp) to our Base Scene and use them in our game.

Select the object and copy it.

Tip

We cannot copy all objects simultaneously, so we need to repeat this process three times.

We cannot directly paste the object, we have to open the edit menu and select paste the object.

Your objects should look like this:

Although we copied the objects, we also need to get the assets of these objects. These are in the assets folder. Edit BasicExplosionSmooth object. Replace the image path by importing a new image. Choose ExplosionTexture1.png from the assets folder. Then, click apply.

Repeat the same process for BasicExplosion. This time, choose Glow.png from the assets folder.

Creating the explosion when an enemy is destroyed

Open the Events tab and go to the Enemies is dead event.

Add a new action to create these explosion objects. Select BasicExplosionSharp and choose create an object. Fill X position with Enemies.X() and Y position with Enemies.Y().

Repeat the same process to create the other two objects. In the end, you should see these events:

Testing out

We are ready to run our game and test the new blinking and explosion effects.

Next step

Space Shooter, Part 12