forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
You can now load in CSV Tilemaps again and they get created properly (f…
…ixes phaserjs#391) You can now create blank Tilemaps and then populate them with data later.
- Loading branch information
1 parent
960e8ca
commit 4a370c8
Showing
8 changed files
with
170 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); | ||
// var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); | ||
|
||
function preload() { | ||
|
||
game.load.tilemap('map', 'assets/tilemaps/csv/catastrophi_level2.csv', null, Phaser.Tilemap.CSV); | ||
game.load.image('tiles', 'assets/tilemaps/tiles/catastrophi_tiles_16.png'); | ||
|
||
} | ||
|
||
var map; | ||
var layer; | ||
var cursors; | ||
|
||
function create() { | ||
|
||
// Because we're loading CSV map data we have to specify the tile size here or we can't render it | ||
map = game.add.tilemap('map', 16, 16); | ||
|
||
// Now add in the tileset | ||
map.addTilesetImage('tiles'); | ||
|
||
// Create our layer | ||
layer = map.createLayer(0); | ||
|
||
// Resize the world | ||
layer.resizeWorld(); | ||
|
||
// Allow cursors to scroll around the map | ||
cursors = game.input.keyboard.createCursorKeys(); | ||
|
||
} | ||
|
||
function update() { | ||
|
||
if (cursors.left.isDown) | ||
{ | ||
game.camera.x -= 4; | ||
} | ||
else if (cursors.right.isDown) | ||
{ | ||
game.camera.x += 4; | ||
} | ||
|
||
if (cursors.up.isDown) | ||
{ | ||
game.camera.y -= 4; | ||
} | ||
else if (cursors.down.isDown) | ||
{ | ||
game.camera.y += 4; | ||
} | ||
|
||
} | ||
|
||
function render() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters