feat: kitteh

This commit is contained in:
cha0s 2019-04-08 22:23:00 -04:00
parent c5e1871c91
commit bb171fef7e
3 changed files with 76 additions and 3 deletions

View File

@ -0,0 +1,7 @@
{
"frameRate": 0.3,
"frameCount": 3,
"frameSize": [16, 16],
"directionCount": 4,
"imageUri": "/kitty.png"
}

BIN
resource/kitty.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

View File

@ -37,14 +37,63 @@ function flowerBarrelJSON(position) {
},
};
}
// A kitteh.
function kittyJSON(position) {
return {
traits: {
animated: {
params: {
animations: {
idle: {
offset: [0, -3],
uri: '/kitty.animation.json',
},
}
},
},
collider: {},
directional: {
params: {
directionCount: 4,
},
state: {
direction: 2,
},
},
existent: {},
graphical: {},
mobile: {
state: {
speed: 80,
},
},
physical: {},
positioned: {
state: {
x: position[0],
y: position[1],
},
},
shaped: {
params: {
shape: {
type: 'rectangle',
position: [0, 0],
size: [8, 4],
},
},
},
},
};
}
// Room.
const roomJSON = {
size: [384, 192],
size: [384, 384],
layers: {
everything: {
entities: [],
tiles: {
size: [24, 12],
size: [24, 24],
data: [
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
@ -58,17 +107,34 @@ const roomJSON = {
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
],
},
tilesetUri: '/tileset.json',
},
},
};
for (let i = 0; i < 10; ++i) {
for (let i = 0; i < 4; ++i) {
const x = Math.floor(Math.random() * 200) + 50;
const y = Math.floor(Math.random() * 75) + 50;
roomJSON.layers.everything.entities.push(flowerBarrelJSON([x, y]));
}
for (let i = 0; i < 4; ++i) {
const x = Math.floor(Math.random() * 200) + 50;
const y = Math.floor(Math.random() * 75) + 50;
roomJSON.layers.everything.entities.push(kittyJSON([x, y]));
}
export function createRoom() {
const room = (new Room()).fromJSON(roomJSON);
room.world = new World();