Skip to content

Instantly share code, notes, and snippets.

@crowcoder
Last active April 30, 2016 22:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save crowcoder/ae5ce413f44dcdc1b3accabbd91851d4 to your computer and use it in GitHub Desktop.
//in the game's preload function you load the image like any other
game.load.image('bkgrnd', 'sprites/background.png');
/*Then you add the tileSprite in create(). This constructor's parameters are, in order:
0 - position of the image on the X coordinate of the game
0 - position of the image on the Y coordinate of the game
640 - Width of the tile
480 - Height of the tile
bkgrnd - key you gave to the image when you loaded it in preload()
see: http://phaser.io/docs/2.4.4/Phaser.TileSprite.html */
game.add.tileSprite(0, 0, 640, 480, 'bkgrnd');
@crowcoder
Copy link
Author

using a tileSprite to act as a background in a Phaser game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment