feat: kitteh
This commit is contained in:
parent
c5e1871c91
commit
bb171fef7e
7
resource/kitty.animation.json
Normal file
7
resource/kitty.animation.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"frameRate": 0.3,
|
||||
"frameCount": 3,
|
||||
"frameSize": [16, 16],
|
||||
"directionCount": 4,
|
||||
"imageUri": "/kitty.png"
|
||||
}
|
BIN
resource/kitty.png
Normal file
BIN
resource/kitty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 961 B |
|
@ -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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 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
||||
1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
||||
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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user