thefootballguy Posted June 29, 2016 Share Posted June 29, 2016 I am trying to create a simple Multidimensional array that will add a sprite to the spot example [0,0] I was following how this http://www.joshmorony.com/how-to-create-a-candy-crush-or-bejeweled-game-in-phaser/ was doing by doing something similar like: this.tileGrid = [ [null, null, null, null, null, null], [null, null, null, null, null, null], [null, null, null, null, null, null], [null, null, null, null, null, null], [null, null, null, null, null, null], [null, null, null, null, null, null] ]; but all I want is being change those position in the grid to sprite and none of the animation just simply to be there. addTileItem: function(x, y){ //Choose a random tile to add var tileToAdd = this.tileTypes[1]; //Add the tile at the correct x position, but add it to the top of the game (so we can slide it in) var tile = this.tiles.create((x * this.tileWidth) + this.tileWidth / 2, 0, tileToAdd); //Animate the tile into the correct vertical position this.game.add.tween(tile).to({y:y*this.tileHeight+(this.tileHeight/2)}, 500, Phaser.Easing.Linear.In, true) //Set the tiles anchor point to the center tile.anchor.setTo(0.5, 0.5); //Enable input on the tile tile.inputEnabled = true; //Keep track of the type of tile that was added tile.tileType = tileToAdd; //Trigger the tileDown function whenever the user clicks or taps on this tile tile.events.onInputDown.add(this.tileDown, this); return tile; }, I think I am overthinking the problem but I been at this for a while any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Recommended Posts