Jump to content

"ClientSmash": a stupid little toy made with Phaser


Cameron Foale
 Share

Recommended Posts

Hi All,

 

I created a little toy using Phaser. It's missing music and some other niceties, but it was done in a few nights.

 

http://www.clientsmash.com

 

The source is available on GitHub at: https://github.com/cocoademon/ClientSmash (it's hosted using GitHub Pages)

 

Works fine on Chrome/Safari. Fails on Firefox on Linux at least, probably elsewhere. Works ok on iPad, but the scaling is off (I used a 1024x768 canvas instead of 1024x672).

 

---

 

All the real action happens here:

https://github.com/cocoademon/ClientSmash/blob/master/src/Game.js

 

It heavily uses Phaser's BitmapData and canvas operations to create the dude's face, and then to take chunks out of it.

 

The code was developed quickly and so has the expected copy-paste coding and minimal commenting, but it might be useful. Caveat lector.

 

---

 

The only real pain-points Phaser-wise were that drawing Sprites to the BitmapData canvas loses all the sprite niceties like atlasing, rotation etc.

Although you could potentially create a new PIXI.CanvasRenderer and go from there, I wanted to avoid using anything outside of Phaser and vanilla HTML5 for this.

 

It would also be nice to have an alternative to Phaser.StageScaleMode.SHOW_ALL that actually adjusts the aspect ratio, which is then available through this.game.widt/height.

From my perusal of the Phaser source this actually seems like a fairly hefty undertaking though,

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...