i3Designer Posted September 20, 2014 Share Posted September 20, 2014 i created this text: this.scoreFinale = game.add.text(209,220, '0', {font: '70px Arial', fill: '#fff'}); this.scoreFinale.setShadow(-10,0,'yellow',5);but does not work...I use Phaser.AUTO Link to comment Share on other sites More sharing options...
Robske Posted September 20, 2014 Share Posted September 20, 2014 What does not work? I do see a yellow shadow... Link to comment Share on other sites More sharing options...
i3Designer Posted September 21, 2014 Author Share Posted September 21, 2014 Why the shadow is deleted? on the left side Link to comment Share on other sites More sharing options...
CtlAltDel Posted September 21, 2014 Share Posted September 21, 2014 Probably because the bounding box of the text is not updated when adding shadow. Link to comment Share on other sites More sharing options...
i3Designer Posted September 21, 2014 Author Share Posted September 21, 2014 how can I solve this ? Link to comment Share on other sites More sharing options...
CtlAltDel Posted September 22, 2014 Share Posted September 22, 2014 It's probably something you can't fix, but needs to be fixed in phaser/pixi Link to comment Share on other sites More sharing options...
lewster32 Posted September 22, 2014 Share Posted September 22, 2014 I believe this is because pixi allocates a texture large enough to contain the text, but does not consider the shadow in that calculation. I guess it's an oversight that should be flagged on Github, though I think it may be a problematic one to fix, as the texture will have to be re-created when you add an effect which changes the size of the original, which without careful calculations will cause your text to 'jump' as the texture size changes. Link to comment Share on other sites More sharing options...
cloakedninjas Posted July 30, 2015 Share Posted July 30, 2015 Sorry about the post necro - but this is the top result for this issue, and I thought I'd share my solution: var text = new Phaser.Text(game, 0, 0, text, { font: '22px Arial', fill: '#C81389', stroke: '#fff', strokeThickness: 4}); text.padding.x = 10;text.setShadow(3, 3, 'rgba(0,0,0,0.5)', 5); Adding padding stops the shadow getting cropped Tilde 1 Link to comment Share on other sites More sharing options...
glantucan Posted August 24, 2015 Share Posted August 24, 2015 Sorry about the post necro - but this is the top result for this issue, and I thought I'd share my solution: var text = new Phaser.Text(game, 0, 0, text, { font: '22px Arial', fill: '#C81389', stroke: '#fff', strokeThickness: 4}); text.padding.x = 10;text.setShadow(3, 3, 'rgba(0,0,0,0.5)', 5); Adding padding stops the shadow getting cropped It doesn't work for me (Phaser 2.4.2) Anyone found another solution for this? Link to comment Share on other sites More sharing options...
frenetikm Posted August 24, 2015 Share Posted August 24, 2015 just add a blank character before / after text solved the problem for me. MichaelD 1 Link to comment Share on other sites More sharing options...
glantucan Posted August 24, 2015 Share Posted August 24, 2015 Yup! I know that But I need a more reliable way to position and align my texts. A character width is different depending on the font. Link to comment Share on other sites More sharing options...
Recommended Posts