Phaser Coding Tips 1 & 2 Revisited: Creating a game like Tanks / Worms

Another one of my “walk-through” of a classic Phaser 2 based tutorial by the great Richard Davey.



I spent hours recreating the “dissolving” shields when writing my Space Invaders clone, thinking to myself, this would be so easy if you could simply check the color of a particular pixel, like in the original arcade game code…well I found out this fantastic tutorial from 9 January 2015 titled “Creating a game like Tanks / Worms” (here), which explains how to do exactly that! For someone like me who came into programming straight into Phaser/Javascript, with no knowledge of HTML this tutorial contained just the information I needed.

Pixel based collision detection

I hope those in similar circumstances will find my Phaser 3 conversion of the original tutorial example useful. My conversion is accessible below. As always I’ve tried to keep the structure of the code similar to the orginal so you can read the original tutorial to make sense of it. I have also jotted down my learnings in my own blog here, which also has a link to the “dissolving shield” that I recreated using pixel detection.

And while I’m at it, I used the techniques I learned to create the “barrels rolling down sloping platforms” effect in the classic Donkey Kong game - the link to the Codepen is in my blog here.

And I also created the basis for a sand simulation by writing and reading of HMTL canvas directly - the link to the Codepen is in my blog here.

Question for the Senpai programmers:
Is there some kind of noise generator method in Phaser 3, like Perlin noise? I am wanting to randomly create the landscape, as suggested by the original tutorial, and I want to confirm that there is/isn’t a built-in Phaser 1 dimensional perlin noise or such like, before I start coding.

1 Like

These are very nice.

There is no Perlin noise in Phaser.

Thank you! When I complete the random terrain generation, I will post for everyone’s review and comment.