Spawn enemies at differrent points in GDevelop 5

I’m going to show you how to spawn enemies at different spawn points in GDevelop 5

The source code is here

State Machine with 3 attack combo in GDevelop

State Machine with 3 attacks

I’m going to show you how to made a simple state machine in GDevelop 5

First grab the assets here

So lets start

Create the Scene

Create a Scene and add all the assets, then create 4 text objects for debug purpose.

The Events of the Game Scene

Creating Player Events

Create an External events and name it Player Events and place this code

Continue inside of the Player Group just below the Direction Group put these events

You’re done with the tutorial

So it’s done, I could not figured out how to play idle animation when the player is in collision with a wall but is up to you to do it. And check the speed of the animations in this demo is set to 0.15 maybe is better to set a lower value so the animation plays fast.

Play it here

Demo:

Grab the source code from GitHub

Different animations for player in GDevelop 5

I’m going to show you how to add different animations for the same player.

The first thing you should do is configure the player animations, I prefer to start with 0 and undescore to separate, so it will be idle_0, run_0, jump_0 …

We are going to end with something like this. for animation 0 and 1

Next step, I alway use Storage to save the game data but this can be done as you want, the important thing is to check which animation the player is going to play depending which armor_equipped he has. So

Create a Scene Variable named gs_armor_equipped assign 0 this is a reference for you to know that idle_0, run_0, jump_0… is going to be plajyed.

Once this setep is done we need to do the logic of the animations in Events, depending on how you move the player for instance

Check if player is on Floor and is not attacking.

if the player is not moving which is perfectly logic at start of the Scene, we play the idle_0 animation, and if the player moves, left or right play run_0 animation

This way for you to change the player armor, sword, helmet or anything you want to attach is so simple as change the value of gs_armor_equipped value.

Build your GDevelop 5 game with yarn electron-builder

First we need to prepare the enviroment:
1 -Download and install yarn: https://yarnpkg.com/en/
2 -Open cmd prompt with administrator rights, change to the directory of your exported game.

Go to your folder game

c:/mygame/> yarn add electron-builder --dev

After the builder finish
Rename the buildResources folder to build go back to command line and write

yarn electron-builder build

After the builder finish, you can now access to the new created folder dist, inside is you game as an installer and another folder named win-unpacked, you can create your own installer using this folder with another software like InnoSetup or InstallForge

You can find detailed information here , the builder is electronjs and you can see the documentation here