espace Posted September 7, 2016 Share Posted September 7, 2016 hi, is it possible to apply the gray filter only on one object and not to all the world as specify in the example. var gray = game.add.filter('Gray'); game.world.filters = [gray]; i try the same method on one sprite but that don't works for me. have you a solution ? thanks. Link to comment Share on other sites More sharing options...
samme Posted September 8, 2016 Share Posted September 8, 2016 I works the same on a sprite: http://codepen.io/anon/pen/QKbaWb You have to include or load the filter script first. Link to comment Share on other sites More sharing options...
espace Posted September 8, 2016 Author Share Posted September 8, 2016 hi samme, thanks for your reply. i know jsfiddle but not codepen, it's funny in fact i have two variable with the same name so the filter doesn't work for this reason how do you do to play with the saturate...i believe that : sprite.filters.x=50 sprite.filters.y=50 works but that don't..... have you an idea ? Link to comment Share on other sites More sharing options...
espace Posted September 8, 2016 Author Share Posted September 8, 2016 solved grayfilter = game.add.filter('Gray');grayfilter.gray = 0.6 Link to comment Share on other sites More sharing options...
espace Posted November 22, 2016 Author Share Posted November 22, 2016 hi, i don't know why but now this filters doesn't work and i do the same than previous... i tried with prototype and normal and the filter doesn't work. is it something changed in Phaser about that ? https://jsfiddle.net/espace3d/yzk3xvgk/ sprite = function(game,posx,posy,im,Group){ this.posx=posx this.posy=posy Phaser.Sprite.call(this,game,this.posx,this.posy,im) Group.add(this) this.grayfiltertop = game.add.filter('Gray') this.grayfiltertop.gray=1 } sprite.prototype = Object.create(Phaser.Sprite.prototype) sprite.prototype.constructor = sprite //////////////////////////////////////////////////////// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); function preload() { game.load.image('icon','https://s16.postimg.org/x73803eph/1_freepik.jpg'); game.load.image('imag','https://s22.postimg.org/5v19iae75/logoveto.png'); game.load.script('gray', 'https://cdn.rawgit.com/photonstorm/phaser/master/filters/Gray.js') } function create() { game.physics.startSystem(Phaser.Physics.ARCADE) var g1=game.add.group() var Sprite = new sprite(game,100,50,'icon',g1) Sprite.filters=[Sprite.grayfiltertop] var Sprite_without_pro=game.add.sprite(100,400,'icon') Sprite_without_pro.filters = [game.add.filter('Gray')] } Link to comment Share on other sites More sharing options...
samme Posted November 22, 2016 Share Posted November 22, 2016 https://jsfiddle.net/yzk3xvgk/1/ I think postimg.org wasn't sending images, you may have to find another asset source. Link to comment Share on other sites More sharing options...
espace Posted November 24, 2016 Author Share Posted November 24, 2016 Hi samme, thanks but that seems not working always...for what i have read filters are not completely supported in Cocoonjs so i work differently and apply a tint effect with the color in grayscale. it's a rustine but that work in all case. Link to comment Share on other sites More sharing options...
Recommended Posts