mirror of
https://github.com/wassname/phaser.git
synced 2026-07-11 00:40:20 +08:00
Tidying up the examples and more Tilemap work.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 126 KiB |
@@ -17,7 +17,7 @@ var waveDataCounter;
|
||||
function create() {
|
||||
|
||||
// Create our BitmapData object at a size of 32x64
|
||||
bmd = game.add.bitmapData('ball', 32, 64);
|
||||
bmd = game.add.bitmapData(32, 64);
|
||||
|
||||
// And apply it to 100 randomly positioned sprites
|
||||
for (var i = 0; i < 100; i++)
|
||||
@@ -62,7 +62,7 @@ function updateWobblyBall()
|
||||
|
||||
// Now all the pixel data has been redrawn we render it to the BitmapData object.
|
||||
// In CANVAS mode this doesn't do anything, but on WebGL it pushes the new texture to the GPU.
|
||||
// If your game is exclusively running under Canvas you ca safely ignore this step.
|
||||
// If your game is exclusively running under Canvas you can safely ignore this step.
|
||||
bmd.render();
|
||||
|
||||
// Cycle through the wave data - this is what causes the image to "undulate"
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ var bmd;
|
||||
|
||||
function create() {
|
||||
|
||||
bmd = game.add.bitmapData('ball', 32, 64);
|
||||
bmd = game.add.bitmapData(32, 64);
|
||||
|
||||
console.log(bmd);
|
||||
|
||||
|
||||
+5
-11
@@ -3,6 +3,9 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload:
|
||||
|
||||
function preload() {
|
||||
|
||||
// game.load.tilemap('map', 'assets/maps/mario1.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
// game.load.tileset('marioTiles', 'assets/maps/mario1.png', 16, 16);
|
||||
|
||||
game.load.tilemap('map', 'assets/maps/newtest.json', null, Phaser.Tilemap.TILED_JSON);
|
||||
game.load.tileset('tiles', 'assets/maps/ground_1x1.png', 32, 32);
|
||||
// game.load.image('phaser', 'assets/sprites/phaser-ship.png');
|
||||
@@ -21,25 +24,20 @@ var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#5c94fc';
|
||||
// game.stage.backgroundColor = '#5c94fc';
|
||||
|
||||
map = game.add.tilemap('map');
|
||||
|
||||
// map.setCollisionByIndexRange(80, 97); // mario
|
||||
map.setCollisionByIndex(1);
|
||||
|
||||
// Phaser.TilemapLayer = function (game, x, y, renderWidth, renderHeight, tileset, tilemap, layer) {
|
||||
|
||||
// layer = game.add.tilemapLayer(0, 0, 800, 600, null, map, 0);
|
||||
layer = game.add.tilemapLayer(0, 0, 800, 600, null, map, 0);
|
||||
|
||||
// layer2 = game.add.tilemapLayer(0, 0, 400, 600, null, map, 0);
|
||||
// layer.cameraOffset.x = 400;
|
||||
// layer.alpha = 0.5;
|
||||
|
||||
// tileset = game.add.tileset('tilesNes');
|
||||
// layer = game.add.tilemapLayer(0, 0, map.layers[0].width*tilesetNes.tileWidth, 600, tileset, map, 0);
|
||||
// disable this and you can place anywhere, but will almost certainly screw collision
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
sprite = game.add.sprite(260, 100, 'phaser');
|
||||
@@ -51,10 +49,6 @@ function create() {
|
||||
// In this case the box is 50px in and 25px down.
|
||||
sprite.body.setSize(16, 16, 8, 8);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// We'll set a lower max angular velocity here to keep it from going totally nuts
|
||||
sprite.body.maxAngular = 500;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user