mirror of
https://github.com/wassname/phaser.git
synced 2026-07-19 11:26:26 +08:00
Tileset working, map coming next.
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
+15
-21
@@ -10,18 +10,8 @@
|
||||
|
||||
function preload() {
|
||||
|
||||
// game.load.image('snes', 'assets/maps/smb_tiles.png');
|
||||
// game.load.tilemap('nes', 'assets/maps/mario1.png', 'assets/maps/mario1.json', null, Phaser.Tilemap.JSON);
|
||||
// game.load.tilemap('snes', 'assets/maps/smb_tiles.png', 'assets/maps/smb_level1.json', null, Phaser.Tilemap.JSON);
|
||||
|
||||
// Just loads the level data and specifies the format
|
||||
// game.load.tilemap('marioLevel1', 'assets/maps/smb_level1.json', Phaser.Tilemap.JSON);
|
||||
|
||||
// What about passing in a JSON object though? Need that too. But a CSV would look like a 'string', not an object - how to tell apart from URL?
|
||||
// game.load.tilemap('marioLevel1', SMB_LEVEL_JSON, Phaser.Tilemap.JSON);
|
||||
|
||||
// Exactly the same as loading a sprite sheet :)
|
||||
game.load.tileset('marioLevel1', 'assets/maps/smb_tiles.png', 32, 32);
|
||||
game.load.tilemap('cybernoidLevel3', 'assets/maps/cybernoid.json', null, Phaser.Tilemap.JSON);
|
||||
game.load.tileset('cybernoidTiles', 'assets/maps/cybernoid.png', 16, 16);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,28 +23,32 @@
|
||||
|
||||
|
||||
|
||||
layer = new Phaser.TilemapLayer(game, 0, 0, 500, 500, [], 'snes');
|
||||
// layer = new Phaser.TilemapLayer(game, 0, 0, 500, 500, [], 'snes');
|
||||
|
||||
// layer = new Phaser.TilemapLayer(game, 0, 0, 500, 500);
|
||||
|
||||
|
||||
// layer.load(mapData, tileset);
|
||||
// layer.create(mapWidth, mapHeight, [tileset]);
|
||||
// layer.updateTileset(key); // can change on the fly
|
||||
|
||||
layer.context.fillStyle = 'rgb(255,0,0)';
|
||||
layer.context.fillRect(0, 0, 200, 300);
|
||||
// layer.updateTileset('cybernoidTiles'); // can change on the fly
|
||||
|
||||
|
||||
// layer.context.fillStyle = 'rgb(255,0,0)';
|
||||
// layer.context.fillRect(0, 0, 200, 300);
|
||||
|
||||
/*
|
||||
game.world._container.addChild(layer.sprite);
|
||||
|
||||
layer.create(10, 10);
|
||||
|
||||
layer.putTile(2, 2, 1);
|
||||
layer.putTile(3, 2, 1);
|
||||
layer.putTile(4, 2, 1);
|
||||
layer.putTile(5, 2, 1);
|
||||
layer.putTile(4, 6, 1);
|
||||
layer.putTile(0, 0, 3);
|
||||
layer.putTile(0, 1, 4);
|
||||
|
||||
layer.render();
|
||||
|
||||
layer.dump();
|
||||
*/
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
Reference in New Issue
Block a user