-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. include:: ../_header.rst | ||
|
||
Compiling animation key constants | ||
--------------------------------- | ||
|
||
You can enable compiling a code file with constant definitions for the animation keys. | ||
|
||
For each animation, the compiler will generate a constant declaration. Like this: | ||
|
||
.. image:: ../images/animtions-editor-compiler-20221114.webp | ||
:alt: Animations constants compiler. | ||
|
||
If you have a lot of animations in your game, we recommend using this feature. You can reference animations using constants (and auto-completion) instead of writing the key names "by hand". | ||
|
||
By default, the compiler is disabled. You can enable it in the **Compiler Settings** section. This section shows when no animation is selected: | ||
|
||
.. image:: ../images/animations-editor-compiler-settings-20221114.webp | ||
:alt: Compiler settings. | ||
|
||
This a table with the parameters: | ||
|
||
* **Generate Code**: Enable the code generation. | ||
* **Output Language**: Choose between JavaScript and TypeScript. | ||
* **ES Module**: If selected, it generates an ES module file. | ||
* **Output Folder**: Choose the parent folder for the output file. If you are using a WebPack or similar bundler, you may want to generate the code in a sub-directory of the `src` folder. | ||
|
||
.. image:: ../images/animations-editor-select-output-folder-20221114.webp | ||
:alt: Select the output folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. include:: ../_header.rst | ||
|
||
Keyboard Key object | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
The |SceneEditor|_ supports adding a `Phaser.Input.Keyboard.Key <https://newdocs.phaser.io/docs/3.55.2/Phaser.Input.Keyboard.Key>`_ object to the scene. Just drag the **Keyboard.Key** object from the |BlocksView|_ and drop it into the scene: | ||
|
||
.. image:: ../images/scene-editor-input-add-key-20221114.webp | ||
:alt: Add Keyboard Key to the scene. | ||
|
||
The editor shows the **Key** objects in the **Input** section of the |OutlineView|_: | ||
|
||
.. image:: ../images/scene-editor-input-keys-in-outline-20221114.webp | ||
:alt: Key objects in the Outline view. | ||
|
||
Select a key for editing its properties in the |InspectorView|_: | ||
|
||
.. image:: ../images/scene-editor-input-key-properties-20221114.webp | ||
:alt: The Keyboard Key properties. | ||
|
||
The **Variable** properties: | ||
|
||
* **Name**: The name of the variable for the Key object. | ||
* **Scope**: The scope of the variable. It may be ``Method``, ``Class``, or ``Public``. If the scope is ``Method``, the variable is local to the "create" method. If the scope is ``Class``, the variable is asigned to a private field of the class. If the scope is ```Public```, the variable is asigned to a public field of the class. | ||
|
||
The **Keyboard Key** properties: | ||
|
||
* **Key Code**: the `keyCode <https://newdocs.phaser.io/docs/3.55.2/Phaser.Input.Keyboard.Key#keyCode>`_. Click on the button for selecting the code: | ||
|
||
.. image:: ../images/scene-editor-input-keycode-dialog-20221114.webp | ||
:alt: KeyCode dialog. | ||
|
||
The code generated for the key code is like this: | ||
|
||
.. code:: | ||
// in the context of a scene: | ||
const jumpKey = this.input.keyboard | ||
.addKey(Phaser.Input.Keyboard.KeyCodes.UP); | ||
// in the context of a prefab: | ||
const jumpKey = this.scene.input.keyboard | ||
.addKey(Phaser.Input.Keyboard.KeyCodes.UP); | ||
A common usage of the keys, is to assign it to a field (set the ``Class`` scope) and check for its **down** state in the **update** method: | ||
|
||
.. code:: | ||
update() { | ||
if (this.jumpKey,isDown) { | ||
this.player.body.velocity.y = -400; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.. include:: ../_header.rst | ||
|
||
Input | ||
----- | ||
|
||
We are exploring on the ways of helping you with the handling of the input of your game. As a start, we are supporting the `Phaser.Input.Keyboard.Key <https://newdocs.phaser.io/docs/3.55.2/Phaser.Input.Keyboard.Key>`_ API in the |SceneEditor|_. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
input-keyboard-key-object |