var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#2d2d2d', parent: 'phaser-example', pixelArt: true, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('tiles', 'assets/tilemaps/tiles/catastrophi_tiles_16.png'); this.load.tilemapCSV('map', 'assets/tilemaps/csv/catastrophi_level2.csv'); } function create () { var map = this.make.tilemap({ key: 'map', tileWidth: 16, tileHeight: 16 }); var tileset = map.addTilesetImage('tiles'); var layer = map.createLayer(0, tileset, 0, 0); // Visual test to make sure tiles don't bleed while scrolling at certain speeds } function update (time, delta) { this.cameras.main.scrollX = (200 + Math.cos(time / 1000) * 200); this.cameras.main.scrollY = (500 + Math.sin(time / 1000) * 500); }
Scan to open on your mobile device
var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#2d2d2d', parent: 'phaser-example', pixelArt: true, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('tiles', 'assets/tilemaps/tiles/catastrophi_tiles_16.png'); this.load.tilemapCSV('map', 'assets/tilemaps/csv/catastrophi_level2.csv'); } function create () { var map = this.make.tilemap({ key: 'map', tileWidth: 16, tileHeight: 16 }); var tileset = map.addTilesetImage('tiles'); var layer = map.createLayer(0, tileset, 0, 0); // Visual test to make sure tiles don't bleed while scrolling at certain speeds } function update (time, delta) { this.cameras.main.scrollX = (200 + Math.cos(time / 1000) * 200); this.cameras.main.scrollY = (500 + Math.sin(time / 1000) * 500); }