playh5 Posted October 26, 2015 Share Posted October 26, 2015 Hi, I'm making something like a board using Phaser. So I have 7 columnds and 7 rows. So my code is something like thisvar row = 0;var lvlColumn = Math.ceil(tempLevel.length/7);for(var i = 0; i < tempLevel.length; i++){ if(this.isInt(i/lvlColumn)){ row++; }//48 is the width and height of squarevar square = this.game.add.sprite((i-(row-1)*lvlColumn)*(48),(row-1)*48,'square');square.inputEnabled = true;square.events.onInputDown.add(this.onClickSquare,this);square.anchor.setTo(0.5,0.5);}So suppose I clicked on row 4 column 4 how am i gonna make the rest of the tile to go to frame 2 diagonally as pictured. Any help would be appreciated. *Edit the index of squares starts from top left and ends in bottom right and never mind the horizontal or vertical. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.