2019-03-27 15:51:58 -05:00
|
|
|
import {World} from '@avocado/physics/matter/world';
|
|
|
|
import {Room} from '@avocado/topdown';
|
2019-04-21 01:31:07 -05:00
|
|
|
|
|
|
|
// Helpers to make scripts for now.
|
|
|
|
const behaviorTraversal = (path, value) => {
|
|
|
|
const traversal = {
|
|
|
|
type: 'traversal',
|
|
|
|
steps: path.map((key) => {
|
|
|
|
return {
|
|
|
|
type: 'key',
|
|
|
|
key: key,
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
};
|
|
|
|
if ('undefined' !== typeof value) {
|
|
|
|
if ('object' === typeof value && 'traversal' === value.type) {
|
|
|
|
traversal.value = value;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
traversal.value = {
|
|
|
|
type: 'literal',
|
|
|
|
value,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return traversal;
|
|
|
|
}
|
|
|
|
|
|
|
|
const behaviorInvoke = (path, args) => {
|
|
|
|
const traversal = behaviorTraversal(path);
|
|
|
|
traversal.steps.push({
|
|
|
|
type: 'invoke',
|
|
|
|
args: args.map((arg) => {
|
|
|
|
if ('object' === typeof arg && 'traversal' === arg.type) {
|
|
|
|
return arg;
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
type: 'literal',
|
|
|
|
value: arg,
|
|
|
|
};
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
return traversal;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Behaviors!
|
|
|
|
const move = behaviorInvoke(['entity', 'moveFor'], [
|
2019-04-21 03:43:20 -05:00
|
|
|
behaviorInvoke(['global', 'randomNumber'], [0.25, 2.5, false])
|
2019-04-21 01:31:07 -05:00
|
|
|
]);
|
|
|
|
|
2019-04-21 03:43:20 -05:00
|
|
|
const stopAnimating = behaviorTraversal(
|
|
|
|
['entity', 'isAnimating'],
|
|
|
|
false
|
|
|
|
);
|
|
|
|
|
2019-04-21 01:31:07 -05:00
|
|
|
const firstWait = behaviorInvoke(['global', 'wait'], [
|
|
|
|
behaviorInvoke(['global', 'randomNumber'], [1, 4, false])
|
|
|
|
]);
|
|
|
|
|
|
|
|
const turn = behaviorTraversal(
|
|
|
|
['entity', 'direction'],
|
|
|
|
behaviorInvoke(['global', 'randomNumber'], [0, 3])
|
|
|
|
);
|
|
|
|
|
|
|
|
const secondWait = behaviorInvoke(['global', 'wait'], [
|
|
|
|
behaviorInvoke(['global', 'randomNumber'], [0.5, 3, false])
|
|
|
|
]);
|
|
|
|
|
2019-04-21 03:43:20 -05:00
|
|
|
const startAnimating = behaviorTraversal(
|
|
|
|
['entity', 'isAnimating'],
|
|
|
|
true
|
|
|
|
);
|
2019-04-21 01:31:07 -05:00
|
|
|
|
2019-04-19 02:54:59 -05:00
|
|
|
// A fire.
|
|
|
|
function fireJSON(position) {
|
|
|
|
return {
|
|
|
|
traits: {
|
2019-04-21 02:28:58 -05:00
|
|
|
animated: {
|
|
|
|
params: {
|
|
|
|
animations: {
|
|
|
|
idle: {
|
|
|
|
offset: [0, 0],
|
|
|
|
uri: '/fire.animation.json',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-04-20 16:09:34 -05:00
|
|
|
audible: {
|
|
|
|
params: {
|
|
|
|
sounds: {
|
|
|
|
fire: {
|
|
|
|
src: '/fire.wav',
|
|
|
|
volume: 0.05,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-04-19 02:54:59 -05:00
|
|
|
collider: {
|
|
|
|
params: {
|
|
|
|
isSensor: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
damaging: {
|
|
|
|
params: {
|
2019-04-20 16:09:34 -05:00
|
|
|
damagingSound: 'fire',
|
2019-04-19 12:16:28 -05:00
|
|
|
damageSpecs: [
|
|
|
|
{
|
|
|
|
affinity: 'fire',
|
|
|
|
lock: 0.15,
|
|
|
|
power: 5,
|
|
|
|
variance: 0.25,
|
|
|
|
},
|
|
|
|
],
|
2019-04-19 02:54:59 -05:00
|
|
|
},
|
|
|
|
},
|
2019-04-21 05:07:46 -05:00
|
|
|
darkened: {
|
|
|
|
params: {
|
|
|
|
isDarkened: false,
|
|
|
|
},
|
|
|
|
},
|
2019-04-19 02:54:59 -05:00
|
|
|
existent: {},
|
2019-04-21 05:07:46 -05:00
|
|
|
visible: {
|
|
|
|
params: {
|
|
|
|
filter: 'bloom',
|
|
|
|
},
|
|
|
|
},
|
2019-04-19 02:54:59 -05:00
|
|
|
physical: {},
|
|
|
|
positioned: {
|
|
|
|
state: {
|
|
|
|
x: position[0],
|
|
|
|
y: position[1],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
shaped: {
|
|
|
|
params: {
|
|
|
|
shape: {
|
|
|
|
type: 'rectangle',
|
|
|
|
position: [0, 0],
|
|
|
|
size: [16, 16],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2019-03-27 15:51:58 -05:00
|
|
|
// A flower barrel.
|
|
|
|
function flowerBarrelJSON(position) {
|
|
|
|
return {
|
|
|
|
traits: {
|
2019-04-20 22:37:59 -05:00
|
|
|
alive: {
|
|
|
|
state: {
|
|
|
|
maxLife: 1000,
|
|
|
|
life: 1000,
|
|
|
|
},
|
|
|
|
},
|
2019-04-08 15:20:43 -05:00
|
|
|
collider: {},
|
2019-04-20 22:37:59 -05:00
|
|
|
emitter: {},
|
2019-04-08 15:20:43 -05:00
|
|
|
existent: {},
|
|
|
|
physical: {},
|
2019-03-27 15:51:58 -05:00
|
|
|
pictured: {
|
|
|
|
params: {
|
|
|
|
images: {
|
|
|
|
initial: {
|
|
|
|
offset: [0, -8],
|
|
|
|
size: [32, 32], // Derive?
|
|
|
|
uri: '/flower-barrel.png',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-04-08 13:32:52 -05:00
|
|
|
positioned: {
|
|
|
|
state: {
|
|
|
|
x: position[0],
|
|
|
|
y: position[1],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
shaped: {
|
2019-03-27 15:51:58 -05:00
|
|
|
params: {
|
|
|
|
shape: {
|
|
|
|
type: 'rectangle',
|
|
|
|
position: [0, 0],
|
|
|
|
size: [20, 10],
|
2019-04-08 13:32:52 -05:00
|
|
|
},
|
2019-03-27 15:51:58 -05:00
|
|
|
},
|
|
|
|
},
|
2019-04-20 22:37:59 -05:00
|
|
|
visible: {},
|
|
|
|
vulnerable: {},
|
2019-03-27 15:51:58 -05:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2019-04-08 21:23:00 -05:00
|
|
|
// A kitteh.
|
|
|
|
function kittyJSON(position) {
|
|
|
|
return {
|
|
|
|
traits: {
|
2019-04-19 14:51:05 -05:00
|
|
|
alive: {},
|
2019-04-08 21:23:00 -05:00
|
|
|
animated: {
|
|
|
|
params: {
|
|
|
|
animations: {
|
|
|
|
idle: {
|
2019-04-21 01:31:07 -05:00
|
|
|
offset: [0, -3],
|
2019-04-08 21:23:00 -05:00
|
|
|
uri: '/kitty.animation.json',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2019-04-20 16:09:34 -05:00
|
|
|
audible: {
|
|
|
|
params: {
|
|
|
|
sounds: {
|
|
|
|
deathSound: {
|
|
|
|
src: '/ded.wav',
|
|
|
|
volume: 0.1,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2019-04-09 09:43:51 -05:00
|
|
|
behaved: {
|
|
|
|
params: {
|
|
|
|
routines: {
|
2019-04-19 15:40:14 -05:00
|
|
|
type: 'routines',
|
|
|
|
routines: {
|
|
|
|
initial: {
|
|
|
|
type: 'routine',
|
|
|
|
routine: {
|
|
|
|
type: 'actions',
|
|
|
|
traversals: [
|
2019-04-21 01:31:07 -05:00
|
|
|
move,
|
2019-04-21 03:43:20 -05:00
|
|
|
stopAnimating,
|
2019-04-21 01:31:07 -05:00
|
|
|
firstWait,
|
|
|
|
turn,
|
|
|
|
secondWait,
|
2019-04-21 03:43:20 -05:00
|
|
|
startAnimating,
|
2019-04-09 09:43:51 -05:00
|
|
|
],
|
2019-04-19 15:40:14 -05:00
|
|
|
}
|
|
|
|
},
|
2019-04-09 09:43:51 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-04-08 21:23:00 -05:00
|
|
|
collider: {},
|
|
|
|
directional: {
|
|
|
|
params: {
|
|
|
|
directionCount: 4,
|
|
|
|
},
|
|
|
|
state: {
|
|
|
|
direction: 2,
|
|
|
|
},
|
|
|
|
},
|
2019-04-20 16:09:34 -05:00
|
|
|
emitter: {},
|
2019-04-08 21:23:00 -05:00
|
|
|
existent: {},
|
2019-04-20 22:37:59 -05:00
|
|
|
visible: {
|
|
|
|
state: {
|
2019-04-21 01:31:07 -05:00
|
|
|
visibleScale: [1, 1],
|
2019-04-20 22:37:59 -05:00
|
|
|
}
|
|
|
|
},
|
2019-04-08 21:23:00 -05:00
|
|
|
mobile: {
|
|
|
|
state: {
|
2019-04-09 09:43:51 -05:00
|
|
|
speed: 40,
|
2019-04-08 21:23:00 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
physical: {},
|
|
|
|
positioned: {
|
|
|
|
state: {
|
|
|
|
x: position[0],
|
|
|
|
y: position[1],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
shaped: {
|
|
|
|
params: {
|
|
|
|
shape: {
|
|
|
|
type: 'rectangle',
|
|
|
|
position: [0, 0],
|
2019-04-21 01:31:07 -05:00
|
|
|
size: [8, 4],
|
2019-04-08 21:23:00 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-04-19 02:54:59 -05:00
|
|
|
vulnerable: {},
|
2019-04-08 21:23:00 -05:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2019-04-21 01:31:07 -05:00
|
|
|
// A MAMA kitteh.
|
|
|
|
function mamaKittyJSON(position) {
|
|
|
|
|
|
|
|
const storeJSON = behaviorTraversal(
|
|
|
|
['context', 'json'],
|
|
|
|
{
|
|
|
|
traits: {
|
|
|
|
positioned: {
|
|
|
|
state: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
const setJSONX = behaviorTraversal(
|
|
|
|
['context', 'json', 'traits', 'positioned', 'state', 'x'],
|
|
|
|
behaviorInvoke(['global', 'multiply'], [
|
|
|
|
behaviorTraversal(['entity', 'x']), 4
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
|
|
|
|
const setJSONY = behaviorTraversal(
|
|
|
|
['context', 'json', 'traits', 'positioned', 'state', 'y'],
|
|
|
|
behaviorInvoke(['global', 'multiply'], [
|
|
|
|
behaviorTraversal(['entity', 'y']), 4
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
|
|
|
|
const spawn = behaviorInvoke(['entity', 'spawn'], [
|
|
|
|
'kitteh',
|
|
|
|
behaviorTraversal(['context', 'json']),
|
|
|
|
]);
|
|
|
|
|
|
|
|
const json = JSON.parse(JSON.stringify(kittyJSON(position)));
|
|
|
|
const {traits} = json;
|
|
|
|
traits.alive.state ={
|
2019-04-21 15:02:18 -05:00
|
|
|
life: 500,
|
|
|
|
maxLife: 500,
|
2019-04-21 01:31:07 -05:00
|
|
|
};
|
|
|
|
traits.animated.params.animations.idle.offset = [0, -8];
|
2019-04-21 03:43:20 -05:00
|
|
|
traits.behaved.params.routines.routines.initial.routine.traversals.push(...[
|
2019-04-21 01:31:07 -05:00
|
|
|
storeJSON,
|
|
|
|
setJSONX,
|
|
|
|
setJSONY,
|
|
|
|
spawn,
|
2019-04-21 03:43:20 -05:00
|
|
|
]);
|
2019-04-21 01:31:07 -05:00
|
|
|
traits.visible.state.visibleScale = [2, 2];
|
|
|
|
traits.shaped.params.shape.size = [16, 8];
|
|
|
|
traits.spawner = {
|
|
|
|
params: {
|
|
|
|
spawns: {
|
|
|
|
kitteh: kittyJSON([100, 100]),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
state: {
|
|
|
|
maxSpawns: 15,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
return json;
|
|
|
|
}
|
2019-03-27 15:51:58 -05:00
|
|
|
// Room.
|
|
|
|
const roomJSON = {
|
2019-04-08 21:23:00 -05:00
|
|
|
size: [384, 384],
|
2019-03-27 17:16:09 -05:00
|
|
|
layers: {
|
|
|
|
everything: {
|
2019-03-27 15:51:58 -05:00
|
|
|
entities: [],
|
|
|
|
tiles: {
|
2019-04-08 21:23:00 -05:00
|
|
|
size: [24, 24],
|
2019-03-27 15:51:58 -05:00
|
|
|
data: [
|
2019-04-12 20:16:58 -05:00
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
2019-04-20 23:27:18 -05:00
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
// 1, 2, 3, 4, 1, 2, 3, 4, 5 , 6 , 7 , 8 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
// 1, 2, 3, 4, 1, 2, 3, 4, 21 , 22 , 23 , 24 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
// 1, 2, 3, 4, 1, 2, 3, 4, 261, 262, 263, 264, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
// 1, 2, 3, 4, 1, 2, 3, 4, 277, 278, 279, 280, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
2019-04-12 20:16:58 -05:00
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
|
|
|
1, 2, 3, 4, 1, 2, 3, 4, 1 , 2 , 3 , 4 , 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
|
2019-03-27 15:51:58 -05:00
|
|
|
],
|
|
|
|
},
|
2019-03-28 02:39:26 -05:00
|
|
|
tilesetUri: '/tileset.json',
|
2019-03-27 15:51:58 -05:00
|
|
|
},
|
2019-03-27 17:16:09 -05:00
|
|
|
},
|
2019-03-27 15:51:58 -05:00
|
|
|
};
|
2019-04-21 15:02:18 -05:00
|
|
|
function mamaKittySpawnerJSON() {
|
|
|
|
|
|
|
|
const storeJSON = behaviorTraversal(
|
|
|
|
['context', 'json'],
|
|
|
|
{
|
|
|
|
traits: {
|
|
|
|
positioned: {
|
|
|
|
state: {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
const setJSONX = behaviorTraversal(
|
|
|
|
['context', 'json', 'traits', 'positioned', 'state', 'x'],
|
|
|
|
behaviorInvoke(['global', 'multiply'], [
|
|
|
|
behaviorInvoke(['global', 'randomNumber'], [50, 234]), 4
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
|
|
|
|
const setJSONY = behaviorTraversal(
|
|
|
|
['context', 'json', 'traits', 'positioned', 'state', 'y'],
|
|
|
|
behaviorInvoke(['global', 'multiply'], [
|
|
|
|
behaviorInvoke(['global', 'randomNumber'], [50, 234]), 4
|
|
|
|
]),
|
|
|
|
);
|
|
|
|
|
|
|
|
const spawn = behaviorInvoke(['entity', 'spawn'], [
|
|
|
|
'mama',
|
|
|
|
behaviorTraversal(['context', 'json']),
|
|
|
|
]);
|
|
|
|
|
|
|
|
return {
|
|
|
|
traits: {
|
|
|
|
behaved: {
|
|
|
|
params: {
|
|
|
|
routines: {
|
|
|
|
type: 'routines',
|
|
|
|
routines: {
|
|
|
|
initial: {
|
|
|
|
type: 'routine',
|
|
|
|
routine: {
|
|
|
|
type: 'actions',
|
|
|
|
traversals: [
|
|
|
|
storeJSON,
|
|
|
|
setJSONX,
|
|
|
|
setJSONY,
|
|
|
|
spawn,
|
|
|
|
],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
existent: {},
|
|
|
|
spawner: {
|
|
|
|
params: {
|
|
|
|
spawns: {
|
|
|
|
mama: mamaKittyJSON([0, 0]),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
state: {
|
|
|
|
maxSpawns: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
2019-04-20 22:37:59 -05:00
|
|
|
|
|
|
|
for (let i = 0; i < 20; ++i) {
|
2019-04-09 15:59:26 -05:00
|
|
|
const x = Math.floor(Math.random() * 284) + 50;
|
|
|
|
const y = Math.floor(Math.random() * 284) + 50;
|
2019-04-10 20:22:09 -05:00
|
|
|
roomJSON.layers.everything.entities.push(flowerBarrelJSON([x * 4, y * 4]));
|
2019-03-27 15:51:58 -05:00
|
|
|
}
|
2019-04-21 15:02:18 -05:00
|
|
|
for (let i = 0; i < 1; ++i) {
|
2019-04-09 15:59:26 -05:00
|
|
|
const x = Math.floor(Math.random() * 284) + 50;
|
|
|
|
const y = Math.floor(Math.random() * 284) + 50;
|
2019-04-21 15:02:18 -05:00
|
|
|
roomJSON.layers.everything.entities.push(mamaKittySpawnerJSON());
|
2019-04-08 21:23:00 -05:00
|
|
|
}
|
2019-04-20 22:37:59 -05:00
|
|
|
for (let i = 0; i < 15; ++i) {
|
|
|
|
const x = Math.floor(Math.random() * 284) + 50;
|
|
|
|
const y = Math.floor(Math.random() * 284) + 50;
|
|
|
|
roomJSON.layers.everything.entities.push(fireJSON([x * 4, y * 4]));
|
|
|
|
}
|
2019-03-27 15:51:58 -05:00
|
|
|
export function createRoom() {
|
2019-03-27 16:11:49 -05:00
|
|
|
const room = (new Room()).fromJSON(roomJSON);
|
2019-03-27 15:51:58 -05:00
|
|
|
room.world = new World();
|
2019-03-27 16:11:49 -05:00
|
|
|
return room;
|
2019-03-27 15:51:58 -05:00
|
|
|
}
|