dartheater Posted March 9, 2018 Share Posted March 9, 2018 I need to know how to program a really simple 6x6 grid in Phaser - I can't figure out how to do it and I've been trying for ages! I am planning on further developing it with some friends later but I need to get this sorted first Link to comment Share on other sites More sharing options...
3man7 Posted March 9, 2018 Share Posted March 9, 2018 Hi, If you mean like a grid out of a sprite then... //create grid group this.mygridGroup = game.add.group(); this.mygridGroup.enableBody = false; for (i = 0; i <= 5; i++) { for (j = 0; j <= 5; j++) { var mygrid = this.mygridGroup.game.add.sprite(50 * j, 50 * i, 'mySprite'); this.mygridGroup.add(mygrid); } } //later on you can set properties to the grid like so... this.mygridGroup.setAll('anchor.x', 0.5); this.mygridGroup.setAll('anchor.y', 0.5); Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts