[Phaser 3] Typescript Gameplay Library

Hello!

Overview

I am a junior developer and relatively new to Phaser 3, Typescript, and web dev in general.

I have been using Phaser + Typescript with @yandeu’s excellent Typescript starter for some personal projects for a bit, and wanted to formalize a couple of the gameplay scripts I had written, and open source it to encourage others to read through my code, help me out, and contribute new ideas!

Find the GitHub repository here.

Key Features

Top Down Movement - WASD Movement for top down games!
‘Feedback’ Tweens - Tweens that disable and enable interactivity, for common “clickable” buttons / interactions
Damage Class - A data-only class that does the standard adding and subtracting for damaged objects.

Notes

It is very small right now, and I am just hoping for some feedback or tips, mainly because I am new to Typescript in general. There are some issues I have been having figuring out how to use types with Phaser’s library, and sometimes I default to using object : any which I know is a big NO in the TS world!

I tried to model some of the gameplay scripts to be bite-sized, Phaser-3-examples types of scripts, so it can easily be dropped into any project!

Let me know your thoughts and if you have any feedback! Please contribute if you’re interested! Thanks!

2 Likes

I have started working on accessibility features in Typescript!

Demo Tweet

install now with npm : npm i cm-phaser-library

WASD movement can be really painful for non QWERTY user. On a french keyboard for instance, W and A are placed differently so WASD would be the equivalent of ZQSD on a QWERTY keyboard. Typing Z to go up is definitely not intuitive.

You should better use physical key instead, like explain here, event if I haven’t tried to implement it on Phaser.

But since you also accept arrow keys as an alternative, that is not so important.

1 Like

Thanks for letting me know, I had never considered that! I appreciate the link, I’m looking into how to implement this for the future. Seems like the better practice overall. Through the link you sent, I found this which I think overviews the key mappings nicely.