admin管理员组文章数量:1410730
I'm trying to have a certain scene in my game where all of the game sprites have a gray overlay on them. I thought about just creating a gray version of each sprite, but then I realized that is not very DRY or easy. I need this overlay for both a singular sprite, like so:
sprite = game.add.sprite(x, y, "name_of_sprite");
And I need it for a group:
group = game.add.group();
How do you this in context of phaser
?
I'm trying to have a certain scene in my game where all of the game sprites have a gray overlay on them. I thought about just creating a gray version of each sprite, but then I realized that is not very DRY or easy. I need this overlay for both a singular sprite, like so:
sprite = game.add.sprite(x, y, "name_of_sprite");
And I need it for a group:
group = game.add.group();
How do you this in context of phaser
?
- 1 please somebody answer this question.. i also in need with the solution. thanks – Vainglory07 Commented Jul 26, 2014 at 7:51
- 1 @Vainglory07 I was able to find an answer for this question – GDP2 Commented Jul 28, 2014 at 16:57
- wooo finally :D thanks – Vainglory07 Commented Jul 31, 2014 at 2:29
1 Answer
Reset to default 5Either one of these solutions will do the trick:
Sprite tinting
yourSpriteName.tint = color;
Gray filter example
var gray = game.add.filter("Gray");
yourSpriteName.filters = [gray];
本文标签: javascriptGiving sprites an overlay in the Phaser frameworkStack Overflow
版权声明:本文标题:javascript - Giving sprites an overlay in the Phaser framework - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745033056a2638615.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论