var config = { type: Phaser.AUTO, parent: 'phaser-example', width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var rt; var layer; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('tiles', 'assets/tilemaps/tiles/tmw_desert_spacing.png'); this.load.tilemapTiledJSON('map', 'assets/tilemaps/maps/desert.json'); } function create () { map = this.make.tilemap({ key: 'map' }); var tiles = map.addTilesetImage('Desert', 'tiles'); layer = map.createLayer('Ground', tiles, 0, 0).setVisible(false); rt = this.add.renderTexture(0, 0, 800, 600); } function update () { rt.camera.rotation -= 0.01; rt.clear(); rt.draw(layer); }
Scan to open on your mobile device
var config = { type: Phaser.AUTO, parent: 'phaser-example', width: 800, height: 600, scene: { preload: preload, create: create, update: update } }; var rt; var layer; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('tiles', 'assets/tilemaps/tiles/tmw_desert_spacing.png'); this.load.tilemapTiledJSON('map', 'assets/tilemaps/maps/desert.json'); } function create () { map = this.make.tilemap({ key: 'map' }); var tiles = map.addTilesetImage('Desert', 'tiles'); layer = map.createLayer('Ground', tiles, 0, 0).setVisible(false); rt = this.add.renderTexture(0, 0, 800, 600); } function update () { rt.camera.rotation -= 0.01; rt.clear(); rt.draw(layer); }