mirror of
https://github.com/wassname/phaser.git
synced 2026-08-01 12:50:06 +08:00
Completely empty Tilemaps can now be created. This allows for dynamic map generation at runtime.
Loads of updates across most the Tilemap files. Not finished yet, still CSV loading to do and a multi-tileset issue to resolve, but it's a lot more flexible now.
This commit is contained in:
@@ -13,6 +13,7 @@ var layer;
|
||||
|
||||
var marker;
|
||||
var currentTile;
|
||||
var cursors;
|
||||
|
||||
function create() {
|
||||
|
||||
@@ -30,6 +31,8 @@ function create() {
|
||||
marker.lineStyle(2, 0x000000, 1);
|
||||
marker.drawRect(0, 0, 32, 32);
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
@@ -52,11 +55,28 @@ 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() {
|
||||
|
||||
game.debug.text('Left-click to paint. Shift + Left-click to select tile.', 32, 32, 'rgb(0,0,0)');
|
||||
game.debug.text('Tile: ' + map.getTile(layer.getTileX(marker.x), layer.getTileY(marker.y)), 32, 48, 'rgb(0,0,0)');
|
||||
game.debug.text('Left-click to paint. Shift + Left-click to select tile. Arrows to scroll.', 32, 32, '#efefef');
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user