Reicher Posted February 6, 2015 Share Posted February 6, 2015 Hi! I'm new to Phaser and are trying to make a simple game in which you can rotate the game board (90 degree steps). on the board there's a a few blocks that should be rotated along with the board. To rotate the board and the blocks around their center anchor points work well with tweens but I haven't managed to get the blocks to rotate nicely along with the board as described in the picture. So far my best solution is to tween the block positions but that doesn't look very good.var goal = new Phaser.Point(this._block.x, this._block.y);goal.rotate(this._center.x, this._center.y, -90, true);this.add.tween(this._block).to({x: goal.x, y: goal.y}, 750, Phaser.Easing.Linear.None, true, 100); I guess i could set the anchor point of each block to the center and then rotate, but how do I translate the board center position to the anchor point format? I could calculate a few points in an arc and interpolate between them. I also heard about tweening in bezier curves. Al this sounds like a bit of overkill, there must be an easier way? My first 10 Google pages are all purple Link to comment Share on other sites More sharing options...
shmikucis Posted February 6, 2015 Share Posted February 6, 2015 I am not fully sure if I got your problem, but I would add board and blocks in one group and rotate this group. Thus I wouldn't deal with each object individually but make one single tween for group. Made a quick example http://mightyeditor.mightyfingers.com/data/projects/p27dx/phaser/index.html Link to comment Share on other sites More sharing options...
Reicher Posted February 6, 2015 Author Share Posted February 6, 2015 Of course! I haven't been playing around with Phaser long enough to realize you could tween whole groups. That's exactly what I needed:) Thanks a lot! Link to comment Share on other sites More sharing options...
Recommended Posts