Serdar Posted August 30, 2015 Share Posted August 30, 2015 I have created a rectangle and attached it to a sprite. (I'm not sure if this is the right way to create a shape, tell me if it's not.) Now I want to change the color of this rectangle dynamically. I have looked into many color related methods with no success. How to do that?var sprite;var graphics;function create() { game.physics.startSystem(Phaser.Physics.ARCADE); graphics = game.add.graphics(0, 0); graphics.beginFill(0xFF700B, 1); graphics.drawRect(0, 0, 100, 100); sprite = game.add.sprite(0, 0); sprite.addChild(graphics);}function update() { if (game.input.activePointer.isDown) { //i want to change the color of the rectangle here }} Link to comment Share on other sites More sharing options...
Recommended Posts