Jump to content

Board


playh5
 Share

Recommended Posts

Hi, I'm making something like a board using Phaser. So I have 7 columnds and 7 rows. So my code is something like this

var 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.

 

post-5125-0-55342300-1445845006.png

 

*Edit

 

the index of squares starts from top left and ends in bottom right and never mind the horizontal or vertical. Thanks in advance

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...