Jump to content

How to put shader pixelate ?


Kallystan
 Share

Recommended Posts

Hello,
I am new to using Phaser for small games and I try to put the shader Pixelate. I do not know how to put it and when I look at the example, this one does not even work. I tried to copy the code from another shader, but this one is different. What should I do ?

Link to comment
Share on other sites

  • 3 months later...

I ran into the same issue. I got it working in my game by doing the following.

Be sure to include the Pixelate.js after you load phaser.js.

(https://github.com/photonstorm/phaser/blob/master/v2/filters/Pixelate.js

 

With that loaded, now you can use the filter.

var pixelate = this.game.add.filter('Pixelate', this.game.width, this.game.height);
pixelate.sizeX = pixelate.sizeY = 4;

var sprite = this.game.add.sprite();
sprite.width = this.game.width;
sprite.height = this.game.height;
sprite.filters = [ pixelate ];

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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