Skip to content

Commit 1c7a874

Browse files
Adds Aseprite code snippet support.
1 parent 9f25d10 commit 1c7a874

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed
44.6 KB
Loading
14 KB
Loading

scene-editor/script-node-vs-user-component.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ The script nodes are logical game objects and you can make prefabs of them. The
2222
Some examples of modeling behaviors with script nodes:
2323

2424
* When you can make logical units that you can combine and make different behaviors. For example, you can make a **StartSceneAction** script node with a **sceneKey** property. This node will start the **sceneKey** scene when it is executed. You can use this script in different contexts:
25-
* In a hierarchy of nodes for starting the Game scene after pressing a **Play** button.
26-
* You can use the same **StartSceneAction** in a hierarchy of nodes that listens to the SPACE key, so it starts the Game scene.
27-
* A **LevelGameplay** script node with the gameplay of a level. You can add this node to a different scene and changes the parameters of the gameplay, for making it harder.
28-
* A **PlayerCollider**, **DestroyObjectAction**, and a **ChangeHealthAction** scripts. You can combine them for expressing when a player hits an object in the level if it will destroy the object and how much it affects the player's health. You can create different combinations for the different kinds of objects in the level.
25+
* In a hierarchy of nodes for starting the Game scene after pressing a **Play** button.
26+
* You can use the same **StartSceneAction** in a hierarchy of nodes that listens to the SPACE key, so it starts the Game scene.
27+
* A **LevelGameplay** script node with the gameplay of a level. You can add this node to a different scene and change the parameters of the gameplay, to make it harder.
28+
* A **PlayerCollider**, **DestroyObjectAction**, and a **ChangeHealthAction** scripts. You can combine them to express when a player hits an object in the level if it will destroy the object and how much it affects the player's health. You can create different combinations for the different kinds of objects in the level.
2929

3030
As we said previously, it is up to you when to use the script nodes and how much you split the behaviors in a tree of small logical units. Our advice is to keep it simple and learn first from your game before making a complex framework of script nodes.

scene-editor/sprite-animations-aseprite.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,33 @@ This is the workflow for working with Aseprite animations in |PhaserEditor|_:
3333
.. image:: ../images/scene-editor-aseprite-animation-block-20231102.webp
3434
:alt: Aseprite animation in the scene editor blocks view.
3535

36+
Aseprite Code Snippets
37+
""""""""""""""""""""""
38+
39+
In Phaser_, before playing an Aseprite_ animation in a sprite, you should create the animations in the Animations Manager.
40+
41+
For creating the animations you should call the `createFromAseprite <https://photonstorm.github.io/phaser3-docs/Phaser.Animations.AnimationManager.html#createFromAseprite__anchor>`_ and pass as argument the Aseprite_ asset key.
42+
43+
In |PhaserEditor|_ you can add this chunk of code in an assisted way:
44+
45+
* Right-click on the scene. It opens the context menu. In the **Code Snippet** menu, select the **Add Create Animations From Aseprite** option.
46+
47+
.. image:: ../images/scene-editor-aseprite-code-snippet-1-20231107.webp
48+
:alt: Select the Aseprite code snippet to add.
49+
50+
* It opens a dialog with all the Aseprite_ asset keys defined in the |AssetPackFiles|_ of the project. Select the one you want to use in your project. Probably all of them:
51+
52+
.. image:: ../images/scene-editor-aseprite-code-snippet-2-20231107.webp
53+
:alt: Select the Aseprite_ asset key.
54+
55+
* Finally, when you compile the scene, it generates these lines of codes at the first lines of the **create()** method of the scene:
56+
57+
.. code::
58+
59+
// snippets
60+
this.anims.createFromAseprite("paladin");
61+
this.anims.createFromAseprite("tank");
62+
3663
Aseprite exporting instructions
3764
"""""""""""""""""""""""""""""""
3865

0 commit comments

Comments
 (0)