diff --git a/Makefile b/Makefile deleted file mode 100644 index e411638..0000000 --- a/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -all: data/sprites.json - -data/sprites.json: asset/ - spriter asset/ - mv sprites.json data/ - mv sprites.png images/ diff --git a/asset/Makefile b/asset/Makefile new file mode 100644 index 0000000..eec611e --- /dev/null +++ b/asset/Makefile @@ -0,0 +1,14 @@ +all: ../data/sprites.json ../images/sprites.png ../images/tiles.png + +../data/sprites.json: sprites/*.png + spriter sprites/ + mv sprites.json ../data/ + rm -f sprites.png + +../images/sprites.png: sprites/*.png + spriter sprites/ + rm -f sprites.json + mv sprites.png ../images/ + +../images/tiles.png: tiles/*.png + montage -tile 1x -geometry 24x24+0+0 -background Transparent $^ $@ diff --git a/asset/astronaut01.png b/asset/sprites/astronaut01.png similarity index 100% rename from asset/astronaut01.png rename to asset/sprites/astronaut01.png diff --git a/asset/minecraft-cake01.png b/asset/sprites/minecraft-cake01.png similarity index 100% rename from asset/minecraft-cake01.png rename to asset/sprites/minecraft-cake01.png diff --git a/asset/neingeist01.png b/asset/sprites/neingeist01.png similarity index 100% rename from asset/neingeist01.png rename to asset/sprites/neingeist01.png diff --git a/asset/starbug01.png b/asset/sprites/starbug01.png similarity index 100% rename from asset/starbug01.png rename to asset/sprites/starbug01.png diff --git a/asset/src/empty.xcf b/asset/src/empty.xcf new file mode 100644 index 0000000..0e822f3 Binary files /dev/null and b/asset/src/empty.xcf differ diff --git a/asset/src/moon.jpg b/asset/src/moon.jpg new file mode 100644 index 0000000..45d7722 Binary files /dev/null and b/asset/src/moon.jpg differ diff --git a/asset/src/moon.xcf b/asset/src/moon.xcf new file mode 100644 index 0000000..f0cf7d6 Binary files /dev/null and b/asset/src/moon.xcf differ diff --git a/asset/src/moontop.xcf b/asset/src/moontop.xcf new file mode 100644 index 0000000..c51da89 Binary files /dev/null and b/asset/src/moontop.xcf differ diff --git a/asset/src/moonx.xcf b/asset/src/moonx.xcf new file mode 100644 index 0000000..b3e841e Binary files /dev/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tiles.png b/images/tiles.png index 9d1831d..4f553a3 100644 Binary files a/images/tiles.png and b/images/tiles.png differ diff --git a/platformer.js b/platformer.js index 0744db3..d12faf1 100644 --- a/platformer.js +++ b/platformer.js @@ -30,7 +30,7 @@ Q.Sprite.extend("Player",{ // You can call the parent's constructor with this._super(..) this._super(p, { sheet: "astronaut", // Setting a sprite sheet sets sprite width and height - x: 410, // You can also set additional properties that can + x: 360, // You can also set additional properties that can y: 90 // be overridden on object creation }); @@ -136,6 +136,8 @@ Q.scene("level1",function(stage) { // Add in a tile layer, and make it the collision layer stage.collisionLayer(new Q.TileLayer({ + tileW: 24, + tileH: 24, dataAsset: 'level.json', sheet: 'tiles' })); @@ -149,11 +151,11 @@ Q.scene("level1",function(stage) { stage.viewport.scale = 2; // Add in a couple of enemies - stage.insert(new Q.Neingeist({ x: 700, y: 0 })); - stage.insert(new Q.Starbug({ x: 800, y: 0 })); + stage.insert(new Q.Starbug({ x: 600, y: 0 })); + stage.insert(new Q.Neingeist({ x: 650, y: 0 })); // Finally add the cake - stage.insert(new Q.Cake({ x: 180, y: 50 })); + stage.insert(new Q.Cake({ x: 146, y: 36 })); }); // To display a game over / game won popup box, @@ -176,8 +178,8 @@ Q.scene('endGame',function(stage) { }); // Expand the container to visibily fit it's contents - // (with a padding of 20 pixels) - container.fit(20); + // (with a padding) + container.fit(16); }); // ## Asset Loading and Game Launch @@ -186,7 +188,7 @@ Q.scene('endGame',function(stage) { // The callback will be triggered when everything is loaded Q.load("sprites.png, sprites.json, level.json, tiles.png, background.png", function() { // Sprites sheets can be created manually - Q.sheet("tiles","tiles.png", { tilew: 32, tileh: 32 }); + Q.sheet("tiles","tiles.png", { tilew: 24, tileh: 24 }); // Or from a .json asset that defines sprite locations Q.compileSheets("sprites.png","sprites.json");