A new release of Phaser Editor 2D is available! Version 3.2.0 includes a lot of new exciting features, like the automatic update and the prefab user properties. But there is a lot more! Including a new video!
Games and tutorials
If you are creating games, tutorials, or any other content (no matter if it is your first project) with Phaser Editor, please, tell us, we will be proud to feature it in our website, newsletter, and social channels.
Weveana studio is making a lot of funny games with Phaser Editor 2D!
Since the previous release, the IDE server looks for new updates and prints a message if there is a new version of the editor. In this release we did more, now you can do a full update of the IDE.
You can use the
-update option to perform a full update of the editor:
$ PhaserEditor2D -update
Or you can use the
-download option to get the latest version for your platform. It is a ZIP file that you can install anywhere:
$ PhaserEditor2D -download
This feature was requested by a user (#32). We love it when you open an issue in our GitHub project, with a feature request or a bug report. Please, don’t keep that bug or that idea in the anonymity.
User properties of prefabs
A prefab is a reusable element of the Scene Editor. It allows you to create a template of an object and create multiple instances of that template. You can change (or overwrite) the properties of a prefab instance to create slightly different objects. Commonly, these properties are part of the Phaser API, like the texture, the tint, the scale, but some times, you need to create custom prefab properties to parametrize the behavior of an object.
A prefab is just a class (generated by the scene compiler), a sub-type of a Phaser built-in game object type, or another prefab. You can insert custom code there, so you can write properties and methods to implement the behavior of the prefab instances.
What’s new now? That you can define the prefab properties directly in the Inspector view, and the scene compiler will generate the code for you. And what is more important, you can edit the value of prefab user properties of the prefab instances, in the Inspector view too. And, like any other built-in property, a user property can be locked/unlocked to its default prefab value.
Take a look at this video: Prefab’s user properties
This is how it looks:
Adding a new user property to a prefab:
Setting the information (Name, Label, Tooltip, etc…) of a property:
Setting the value of a property in a prefab instance:
This is a simple, but powerful new resource that boosts your productivity. It allows you to create reusable types and assists you on tweak some aspects of the game-play.
A shortcut to create a prefab
The regular procedure to create a prefab is opening the New File dialog and select the Prefab File option. But now you can select an object in the Scene Editor and convert it to a prefab. It is a shortcut.
- Open the context menu and select the option Create Prefab With Object :
- It opens the New Prefab File dialog. Select the name and the folder for the new prefab file:
- The new prefab is created. The object is converted into a prefab instance, and the new prefab file is shown in the Blocks view:
Quick code editor for the Scene Editor
If you are running Phaser Editor 2D IDE locally, we recommend using an external editor to write the code. Especially, we recommend Visual Studio Code. We are focused on providing design tools. However, in many cases, you would prefer to use the internal code editors provided by Phaser Editor 2D.
In this release, we implemented a command to open a popup editor of the scene code. When you are building a scene in the Scene Editor, press
Q or select the Quick Edit Output File option in the context menu. It opens a modal dialog with the code generated by the scene compiler:
More integration with Visual Studio Code
Again, we encourage you to use Visual Studio Code for coding. In this release, we added a command to open your game project in Visual Studio Code. Just press
Ctrl+Alt+U or select Open Visual Studio Code in the main menu.
Also, if you are working in the Scene Editor, you can open the scene compiled code in the Visual Studio Code with the command Open Output File in VS Code , available in the context menu.
These options are available only if you are running Phaser Editor 2D server in desktop mode:
$ PhaserEditor2D -desktop
By the way, the
code executable should be included in the
PATH environment variable of your OS. This should be done automatically if you run the Visual Studio Code installer. Else, you should tweak your system to make globally available the
Keeping the original texture when morphing objects
The Scene Editor allows you to change the type of an object but keeping the same data. For example, you can convert a Text object into a BitmapText, and keep the same object’s text, origin, scale, etc… Often, you realize some objects of your scene have common properties and behavior so you decide to create a prefab for it. So, you create a new prefab and then convert all the objects to the new prefab. However, what properties should be preserved, and what properties should get the values of the prefab? By default, all properties of the objects will be locked to the prefab values. This means all objects will use the same texture of the prefab. We think that in many cases, you would like to keep the texture of the object. In this release we added the option Keep the original prefab texture to the Replace Type dialog. So when you convert the objects they will look the same.
In a future release, we will implement a more general solution. When you select to replace a type of an object, it will show you a dialog with all the properties you may want to keep with the original values, not only the texture.
- Scene Editor: removes extra blank lines in generated code.
- Scene Editor: the translate and rotate manipulators set integer values to objects.
- Files view: the context menu New option does not open the New File dialog. Now it is a sub-menu with the shortcuts to create a new file of any supported content type.
- When running the game, the server sends instructions to the browser to avoid resource caching. The browse should show always the current version of the game resources.
- Don’t activate the editor when clicking on the close button of the editor tab.
- Monaco editor: on a model change, if the model content is the same of the file content then the editor is not marked as dirty (unsaved).
- Scene Editor: fixes the type-inference of an empty Object List.
The next in line big feature is the Object Scripting System. This allows you to extend the logical state or behavior of an object. The prefab system is great but it requires creating a new sub-type, so things can get complex when you want to refactor objects of different types (for example, you cannot create a prefab to express a moving behavior and appl). However, the same Object Script implementation can be used to extend objects of different types. This will be handy to express more game-play concepts in the Scene Editor.
Keep in contact!