MadOwl Posted November 27, 2016 Share Posted November 27, 2016 Hello! I finally decided to try to use TexturePacker. This tool looks promising. Now I am just rewriting tons of my code. Here's the question, I hope some of you, friends, might be able to help me: My old code: var background = game.cache.getImage(backgroundName); something.drawImage(background, 0, 0, background.width, background.height, 0, 0, gameWidth, gameHeight); Can I do the same thing, but with background image being placed into texture atlas which will also include multiple other images? How can I do ' var background = game.cache.getImage(backgroundName);', but with texture atlas use? It seems methods like getFrameData return only some info strings. Link to comment Share on other sites More sharing options...
BdR Posted December 2, 2016 Share Posted December 2, 2016 Not exactly sure what you mean, but why not just use a sprite to show the background? // use a sprite var background = game.add.sprite(0, 0, 'yourassetkey', 'theframename'); // and if you want, stretch it to entire game area background.width = game.width; background.height = game.height; Or if the graphics should be a repeating pattern, like bricks or grass or something like that, you can use the Phaser.TileSprite class. // use a tile sprite var background = game.add.tileSprite(0, 0, game.width, game.height, 'yourassetkey', 'brickspattern'); Link to comment Share on other sites More sharing options...
javi.hernandez-374501 Posted December 4, 2016 Share Posted December 4, 2016 I think you are looking for the property Sprite.FrameName = "backgroundname" Link to comment Share on other sites More sharing options...
Recommended Posts