MichaelD Posted July 18, 2014 Share Posted July 18, 2014 I'm using filters as follows:background = game.add.sprite(0, 0); background.width = 800; background.height = 600; filter = game.add.filter('Gray', game.width, game.height); //error here filter.alpha = 0.0; background.filters = [filter];I get: Uncaught TypeError: undefined is not a function Firefox gives a bit more info: TypeError: b.Filter[a] is not a constructor Anyone has any ideas? Thanks! Link to comment Share on other sites More sharing options...
MichaelD Posted July 19, 2014 Author Share Posted July 19, 2014 If anyone hasn't seen this error before maybe if I post what I'm trying to do will result in some input, I'm trying to apply the gray filter to the whole state so that everything looks B&W. Thanks again. Link to comment Share on other sites More sharing options...
Massemassimo Posted August 5, 2014 Share Posted August 5, 2014 I do have trouble with trying the same: var gray = this._game.add.filter('Gray');throws the error "supplied parameters do not match any signature of call target". When I add "null" as another argument, visual studio (or phaser.d.ts) is happy, but the next line,this._skin.filters = [gray];throws "cannot convert '{}[]' to 'PIXI.AbstractFilter[]'". Since those lines are used in a phaser example (Filters > Gray), I am guessing there is something wrong with the phaser.d.ts? Or did pixi update some filters code? Link to comment Share on other sites More sharing options...
aurelien974 Posted November 14, 2014 Share Posted November 14, 2014 Hi there ! I had the same problem with the same error when I wanted to apply a pixelating filter to a sprite. I found a solution, here is what I do : I'm using a filter from Pixi.js.I load it :this.load.script("pixelate", "PixelatePIXI.js");I apply it on my sprite like that :MyGame.pixelate = new PIXI.PixelateFilter(); // name of the filter function in PixelatePIXI.jsMyGame.mySpriteToPixelate.filters = [MyGame.pixelate];(Note that I didn't use the "pixelate" string name I chose when loading the script, so it may not be the right way to do it, but it works fine...) Hope this helps Link to comment Share on other sites More sharing options...
discoman Posted July 11, 2016 Share Posted July 11, 2016 Pixi filters are not present in phaser. Thus you need to load them first after downloading from the Phaser repo seperately. Once you load the filter, it makes sense that they may be used directly through the PIXI object which would have not been possible otherwise, because earlier they were not present. Hope I am not stating the obvious. Link to comment Share on other sites More sharing options...
Recommended Posts