add new tiles
6
Makefile
|
@ -1,6 +0,0 @@
|
||||||
all: data/sprites.json
|
|
||||||
|
|
||||||
data/sprites.json: asset/
|
|
||||||
spriter asset/
|
|
||||||
mv sprites.json data/
|
|
||||||
mv sprites.png images/
|
|
14
asset/Makefile
Normal file
|
@ -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 $^ $@
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 238 B After Width: | Height: | Size: 238 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
BIN
asset/src/empty.xcf
Normal file
BIN
asset/src/moon.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
asset/src/moon.xcf
Normal file
BIN
asset/src/moontop.xcf
Normal file
BIN
asset/src/moonx.xcf
Normal file
|
@ -1,16 +1,16 @@
|
||||||
[
|
[
|
||||||
[ 1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
|
[ 3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,3,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0],
|
||||||
[ 1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0],
|
[ 1,1,1,1,1,0,0,0,0,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1,1,1,1]
|
||||||
]
|
]
|
||||||
|
|
BIN
images/tiles.png
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 3.4 KiB |
|
@ -30,7 +30,7 @@ Q.Sprite.extend("Player",{
|
||||||
// You can call the parent's constructor with this._super(..)
|
// You can call the parent's constructor with this._super(..)
|
||||||
this._super(p, {
|
this._super(p, {
|
||||||
sheet: "astronaut", // Setting a sprite sheet sets sprite width and height
|
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
|
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
|
// Add in a tile layer, and make it the collision layer
|
||||||
stage.collisionLayer(new Q.TileLayer({
|
stage.collisionLayer(new Q.TileLayer({
|
||||||
|
tileW: 24,
|
||||||
|
tileH: 24,
|
||||||
dataAsset: 'level.json',
|
dataAsset: 'level.json',
|
||||||
sheet: 'tiles' }));
|
sheet: 'tiles' }));
|
||||||
|
|
||||||
|
@ -149,11 +151,11 @@ Q.scene("level1",function(stage) {
|
||||||
stage.viewport.scale = 2;
|
stage.viewport.scale = 2;
|
||||||
|
|
||||||
// Add in a couple of enemies
|
// Add in a couple of enemies
|
||||||
stage.insert(new Q.Neingeist({ x: 700, y: 0 }));
|
stage.insert(new Q.Starbug({ x: 600, y: 0 }));
|
||||||
stage.insert(new Q.Starbug({ x: 800, y: 0 }));
|
stage.insert(new Q.Neingeist({ x: 650, y: 0 }));
|
||||||
|
|
||||||
// Finally add the cake
|
// 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,
|
// 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
|
// Expand the container to visibily fit it's contents
|
||||||
// (with a padding of 20 pixels)
|
// (with a padding)
|
||||||
container.fit(20);
|
container.fit(16);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ## Asset Loading and Game Launch
|
// ## Asset Loading and Game Launch
|
||||||
|
@ -186,7 +188,7 @@ Q.scene('endGame',function(stage) {
|
||||||
// The callback will be triggered when everything is loaded
|
// The callback will be triggered when everything is loaded
|
||||||
Q.load("sprites.png, sprites.json, level.json, tiles.png, background.png", function() {
|
Q.load("sprites.png, sprites.json, level.json, tiles.png, background.png", function() {
|
||||||
// Sprites sheets can be created manually
|
// 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
|
// Or from a .json asset that defines sprite locations
|
||||||
Q.compileSheets("sprites.png","sprites.json");
|
Q.compileSheets("sprites.png","sprites.json");
|
||||||
|
|