dcf Posted May 20, 2014 Share Posted May 20, 2014 Hi, I have a problem with adding a filter to a sprite in Phaser 2.0.5. I tried to follow the examples, but they seems to be outdated. For example - game.add.filter returns Phaser.Filter which I can't add to a sprite since sprite.filters is an array of PIXI.AbstractFilter and it's impossible to cast Phaser.Filter to PIXI.AbstractFilter.It also seems like signature of game.load.script has changed - it requires two more arguments (only two are expected in the examples) Any ideas how to make filters work in this version of phaser? I am using the newest version of TypeScript. Thanks in advance for your help. Link to comment Share on other sites More sharing options...
clark Posted May 21, 2014 Share Posted May 21, 2014 Hey dcf. You are right. There should be 2 required parameters and 2 optional. This is fixed for next pull request. But yeah, I am having some trouble getting this working. The Filters property appears to come from PIXI.DisplayObject and is of type PIXI.AbstractFilterBut Phaser.Filter has nothing to do with PIXI.AbstractFilter, atleast it does not extend it. The other problem is with dynamic properties. For example, I can get a Filter loaded, but I cannot say:filter.speed = 10 (on the Marble Filter) because Phaser.Filter does not contain a speed property. Since any filter could have any number of dynamic parameters unknown in advance, I am not sure how to define it.Does anyone have any ideas on this? Link to comment Share on other sites More sharing options...
clark Posted May 21, 2014 Share Posted May 21, 2014 http://stackoverflow.com/questions/21506149/can-you-dynamically-extend-a-type-in-typescript So maybe the only answer is to make filters: any[] ? Link to comment Share on other sites More sharing options...
Recommended Posts