yegorf1 Posted May 1, 2014 Share Posted May 1, 2014 Hello! Just started to learn phaser and have a question:I have a gray sprite, how can I make it draw blue and after some event make it red? I tried to find it but haven't any progress. If there're no solutions, all task:I want to make blue circles with physics body and if circle is colise with another - change color of both to red. Thanks.Sorry, for bad english :| Link to comment Share on other sites More sharing options...
charlie_says Posted May 1, 2014 Share Posted May 1, 2014 var sprite = game.add.sprite(0, 0, 'yourGraphic'); sprite.tint = 0xff00ff; ZED and yegorf1 2 Link to comment Share on other sites More sharing options...
yegorf1 Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks. Link to comment Share on other sites More sharing options...
yegorf1 Posted May 1, 2014 Author Share Posted May 1, 2014 There is another question: How can I convert RGB to hex, e.g. (255, 0, 255) to 0xff00ff.Is it R * 164 + G * 162 + B? Link to comment Share on other sites More sharing options...
DanEEStar Posted May 1, 2014 Share Posted May 1, 2014 There is another question: How can I convert RGB to hex, e.g. (255, 0, 255) to 0xff00ff.Is it R * 164 + G * 162 + B? This stackoverflow answer helped me for that:http://stackoverflow.com/a/5624139/669561 Link to comment Share on other sites More sharing options...
charlie_says Posted May 1, 2014 Share Posted May 1, 2014 (via google)function RGBtoHEX(r, g, { return r << 16 | g << 8 | b;}All values need to be in the range 0 to 255, (0x00 to 0xff) yegorf1 1 Link to comment Share on other sites More sharing options...
yegorf1 Posted May 1, 2014 Author Share Posted May 1, 2014 Thanks again. Link to comment Share on other sites More sharing options...
Recommended Posts