diff --git a/resource/kitty.animation.json b/resource/kitty.animation.json new file mode 100644 index 0000000..b1b70dd --- /dev/null +++ b/resource/kitty.animation.json @@ -0,0 +1,7 @@ +{ + "frameRate": 0.3, + "frameCount": 3, + "frameSize": [16, 16], + "directionCount": 4, + "imageUri": "/kitty.png" +} diff --git a/resource/kitty.png b/resource/kitty.png new file mode 100644 index 0000000..8f53782 Binary files /dev/null and b/resource/kitty.png differ diff --git a/server/create-server-room.js b/server/create-server-room.js index 14e8c0d..a9c4089 100644 --- a/server/create-server-room.js +++ b/server/create-server-room.js @@ -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();