Even if point-and-click games are one of the most static ones, animations, since the beginning, are part of the experience. There are several types, for instance:
In Godot Engine, there are several ways to do animations (see https://fr.flossmanuals.net/godot-game-engine/animation/) but with Escoria we'll preferably use a combination of an AnimatedSprite node with an 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, so if he receives the right bamboo, he'll be happy, and in other cases he'll be angry. Without doing complex animations, we can use this example to change the 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 incorporate animation.
If we have a character scene built like this:
In the properties of the AnimatedSprite node (here named "Sprite"), we have a Frames property. Click on it, choose New SpriteFrame and enter the new SpriteFrame by clicking the > at the right.
Click on the Load Resource button (the folder icon at the left of paste) and browse the directory containing your graphics. Select all the state images at once and load them. Each will appear in a separate slot, with an associated number representing the frame.
With that, you've done half of the job.
Now select the AnimationPlayer 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 validate, it will appear in the drop-down list at the right of the icon bar (here where neutral is shown). This name is important because we’ll refer to it from our Escoria scripts.
In that animation, we now need a track. Add one by clicking the + at the bottom right of the panel. In the pop-up menu, choose Normal track and then rename the track to "Sprite:frame".
Finally, you can add a key frame 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 key frame 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). Click on the small key icon at the right of the value to set the key value.
You can check the value of any animation key by clicking, at the bottom-right corner of the animation panel, on the pen icon with a circle, and check the Key tab. For "neutral", it should display Time:0, Value:2.To have better control on the delays, we can set length of the animation to 0.1, at the bottom of the animation panel.
Repeat those step by creating an animation for each state.
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.
For the "neutral" animation, click the "A" icon (Autoplay on Load) at the right of the animation names drop-down list.
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 :
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 play 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.