madhurhtml5 Posted March 25, 2014 Share Posted March 25, 2014 Hello, I am making a game consisting of a 2D array.The game concept is same as that of candy crush, (2 swap between 2 items from the group).For this i have to make a 2D array of sprites and so i have made a class and want to extend it with sprite so that i can create its objects to bring those sprites in 2D array on the screen.using object_name = new Class_name() is giving error. Please do suggest. Thanks in advance. Link to comment Share on other sites More sharing options...
SteveB Posted March 25, 2014 Share Posted March 25, 2014 Have you thought of using a Tilemap to represent the 2D array? Tilemap already has methods for swaping tiles etc. If you want to extend do something likevar MySuperTilemap = function(game, key, tileWidth, tileHeight, width, height) { Phaser.Tilemap.call(this, game, key, tileWidth, tileHeight, width, height); // @todo my construction stuff};MySuperTilemap.prototype = Object.create(Phaser.Tilemap.prototype);MySuperTilemap.prototype.constructor = MySuperTilemap;MySuperTilemap.prototype.coolMethod = function(something) { //@todo more stuff}; Link to comment Share on other sites More sharing options...
Recommended Posts