Adding transition when entering a stage on Phaser JS - Game Devlog #16

Written in December 29, 2020 - 🕒 1 min. read

Wassup everyone, I’m once again late with my “weekly” devlog, due to the holidays and stuff. But let’s drop the small talk and cut to the chase.

This is very simple to do, but it adds a nice polishing level to the game. First I created a new scene called StagePresentationScene. In it, I get the variable stageName and show it in the middle of the screen for 1.5 seconds.

import { Scene } from 'phaser';
import { handleSceneEnd } from '../utils/scenes';

class StagePresentationScene extends Scene {
    constructor() {

    init(data) {
        this.initData = data;

    create() {
            this.cameras.main.width / 2,
        ).setDepth(50).setOrigin(0.5, 0.5);

            () => handleSceneEnd(this, 'GameScene', this.initData)

export default StagePresentationScene;

I can access the stageName attribute from Tiled with a simple filter function.

// stageNameProperty will be an object with a property value in it
const stageNameProperty = stageJson?.properties?.find(
    (property) => === STAGE_NAME

This is very simple to do but makes the game way better looking.

Stage transition

And that’s it. Don’t forget to add the stageName property to your Tiled map properties. See you next week.


Post a comment


No comments yet.