Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhaserEditor2D committed Nov 16, 2022
2 parents 5d55f57 + 55509f4 commit fed7aa3
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## v3.36.0 - Nov 15, 2022

* Animations Editor: allows compiling the animation constans.
* The Keyboard Key section.

## v3.35.2 - Nov 10, 2022

Update version.
Expand Down
28 changes: 28 additions & 0 deletions animations-editor/compiler.rst
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.
1 change: 1 addition & 0 deletions animations-editor/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Animations Editor
auto-build-animations
edit-animations-properties
adding-deleting-frames
compiler

`Sprite animations <https://photonstorm.github.io/phaser3-docs/Phaser.Animations.Animation.html>`_ are the most frequent option to animate characters in Phaser_ games. The principle of this animation technique is the displaying of a sequence of images (frames), at a given "speed" or frame rate.

Expand Down
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
# built documents.
#
# The short X.Y version.
version = u'v3.35.2'
version = u'v3.36.0'
# The full version, including alpha/beta/rc tags.
release = u'v3.35.2'
release = u'v3.36.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added images/animtions-editor-compiler-20221114.webp
Binary file not shown.
Binary file added images/scene-editor-input-add-key-20221114.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions scene-editor/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Scene Editor
working-with-parent-objects
object-list
display-list
input
prefabs
user-components
manipulation-tools
Expand Down
58 changes: 58 additions & 0 deletions scene-editor/input-keyboard-key-object.rst
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;
}
}
11 changes: 11 additions & 0 deletions scene-editor/input.rst
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

0 comments on commit fed7aa3

Please sign in to comment.