uri Posted April 14, 2015 Share Posted April 14, 2015 Hi, I want to rotate a line from an anchor point but I'm having an issue trying to do this "simple" operation. this is my code: create:this.angle = 0;this.graphics = game.add.graphics(50, 50);update:if (game.input.activePointer.isDown) { this.angle += 10; var front = new Phaser.Point(1, 0); front = Phaser.Point.rotate(front, 50, 50, this.angle, true); this.graphics.kill(); this.graphics = game.add.graphics(50, 50); //could use moveTo this.graphics.lineStyle(1, 0x0000ff, 1); this.graphics.lineTo(front.x,front.y); }The result i'm getting is a line rotating but not in the expected way , it seems it's stuck inside a rectangle. It's like I need to set an anchor point ... I'm sure I misunderstood the rotate method or the math behind (maybe both ) Link to comment Share on other sites More sharing options...
Nikow Posted April 14, 2015 Share Posted April 14, 2015 Have you try to put the line into a bitmap object and rotate it after ? Link to comment Share on other sites More sharing options...
uri Posted April 14, 2015 Author Share Posted April 14, 2015 Thank you for the answer, It worked When should I use bitmap data instead of graphics? Link to comment Share on other sites More sharing options...
Recommended Posts