Sites


Creating Point and Click Games with Escoria

Animations

Even if point-and-clicks games are one of the most static ones, animations, since the beginning, are part of the experience. They can be several type, for example :

  • the player or character standing and waiting
  • items that contains changes (for example a tv white snow noise effect)
  • the player moving from one place to another
  • an item or a character that have a different state (happy, unhappy, estonished…)

State animation

In Godot Engine, there are several ways to do animations (see https://fr.flossmanuals.net/godot-game-engine/animation/) but with Escoria will preferably use a combination of an animatedSprite node with a animation node so that we can enable an animation using the set_state animation_name command in the scenarios.

Let’s take the Bamboo_god as an example. In our story, the little panda may give him the good or the bad bamboo. We can assume the god will react to that gift and if he receive the right bamboo, he will be happy, and in other cases be angry. Without doing complex animations, we can use this example to change to aspect of the god and let the player now if he succeeded or not. There is no mean, in Escoria, to replace a sprite by another. The only way to change the aspect of an item or character is to have animation incorporated.

If we have a character scene build like this :

In the properties of the animatedSprite node (here named Sprite), we will have a frame setting. Click on the Frames value and choose New SpriteFrames and enter this spriteFrame by clicking the > at the right.

Click on the Load ressource button (at the left of paste) and go browse the directory containing your graphics. Select all the state images at once and load them. They will appear each in a slot, with an associated number representing the frame.

 

Once you've done that, you've done half of the job. Select now the animation node and go to animation panel at the bottom of main area.

Click the Create new Animation on top of the panel and give a name to your animation. After you have validated, it will appear in the drop down list on the right of the icon bar (here where neutral is shown). This name is important because we’ll refer to it from our escoria script.

Create animation in Godot

In that animation, we now need a track. Add one by clicking the + at the bottom right of the panel. In the popup menu, choose Normal track and then rename the track to Sprite:frame.

Finally, you can add a keyframe to set changes for each track. In our simple changing state animation, we will use only one frame in which we will store the right state. At the right of the track, click the green + to add a keyframe at the animation player position (red line) which should remain at 0.

At this step, click on the god picture in the 2D editor or on the animatedSprite node and change the Frame property to the right number. In our case, we do the neutral state/animation, so that it should be 2 (as shown in the animation Frame screenshot above).

Repeat those step by creating an animation for each state.

To have better control on the delays, we can set length of the animation to 0.1, at the bottom of the animation panel.

Now you should be able to choose between animation in the drop down list and play them in the animation panel to test if they are ok.

The last thing we have to do is the use those animation states in the script. In the bamboo_god.esc file, we have to define that if the inv_good_bamboo is used, the state changes to happy, for example. This will give :

:use inv_good_bamboo

set_state bamboo_god happy
say bamboo_god "Thank you for your kind offering young panda, you shall receive my blessings."

set_state tells to change the state of the bamboo_god global Id, and to launch the animation named happy.

Il y a une erreur de communication avec le serveur Booktype. Nous ne savons pas actuellement où est le problème.

Vous devriez rafraîchir la page.