From bb171fef7ecdcd98332e26d6f4d38dcb71576b2c Mon Sep 17 00:00:00 2001 From: cha0s Date: Mon, 8 Apr 2019 22:23:00 -0400 Subject: [PATCH] feat: kitteh --- resource/kitty.animation.json | 7 ++++ resource/kitty.png | Bin 0 -> 961 bytes server/create-server-room.js | 72 ++++++++++++++++++++++++++++++++-- 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 resource/kitty.animation.json create mode 100644 resource/kitty.png 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 0000000000000000000000000000000000000000..8f5378213c65a5e86dda724f7e527b35e4713ef7 GIT binary patch literal 961 zcmV;y13vtTP)Y!8_CkkJmG65o9ce>1u zAMOK46CmQ#I8mGVL8*gkd^Ym~IY_7kc<~y>ADszG5NQHLd>SY96XVY7>oV)lge?I$ zmQMmXe4PRP#JJ;>&YKA^N3bh~l(#M-9DuWiHuFRM;J8zLqbTJYb5O(jJMJRJH|MS+ zZyrNB3)J}^A^}`JvITkERR92Rdvgi1>7?-;rCp?-0RZ5~{VxCjSnqT8X8N2TxyM}v z+cK|XzWGLCW{^Ama14BZRt$5laTc+e0AC)nK2k=kr9$2?biA>>i!;JdF}(RSPLx{8 z7LzoFjgP3{dY?n_P>3=oiP6iuvSP|x>W&;TMi(FHf7q6}^C7-o|J?<@EzZ0$D2>s{ zyEY50MX(w?zXFx5ly#%CC4dq`!bezp=uyDIX46SS2Ni1tFHco#Zf?sQ*83(;i6P~C z4-jVteQo#p`%Ds}kJo=mb_Sk@ zoCCT3xx+(kO6~Y@=4r;H5DpU_*uZO4)jQ0B2{>K`?VBUWS|Nbq!e@cs7I^3rt5?0KcmR{G!;c~Hk z-Yt^yjS;}UJNDzvo7rj!6t=60_%u#bwrXl{?aAA+ZSJyE)>aFU^7Wbc<*9;Vtr{lp z?agIt%52NLCC;cU!14WuFO#EKn@uMw1aCD~yF7ZA^+;iD?;lBds}Q4hp38>jBbOGp z`SX-lZm^ecV|5Ln>l`5Aoi=&j>yKE&oArU-(vWdqS8ai9t#IlDE)DOh8Bh}Esu_6c j?^AgDA?picJ5~Dw`1|ELvd|Wu00000NkvXXu0mjfj;hCf literal 0 HcmV?d00001 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();