42 lines
979 B
JavaScript
42 lines
979 B
JavaScript
import createEcs from './create-ecs.js';
|
|
|
|
export default async function createHomestead(Ecs) {
|
|
const ecs = createEcs(Ecs);
|
|
const area = {x: 100, y: 60};
|
|
await ecs.create({
|
|
AreaSize: {x: area.x * 16, y: area.y * 16},
|
|
Ticking: {},
|
|
TileLayers: {
|
|
layers: [
|
|
{
|
|
area,
|
|
data: Array(area.x * area.y).fill(0).map(() => 1 + Math.floor(Math.random() * 4)),
|
|
source: '/assets/tileset.json',
|
|
tileSize: {x: 16, y: 16},
|
|
}
|
|
],
|
|
},
|
|
Water: {water: {}},
|
|
});
|
|
await ecs.create({
|
|
Collider: {
|
|
bodies: [
|
|
[
|
|
{x: -36, y: -16},
|
|
{x: -21, y: -16},
|
|
{x: -36, y: -1},
|
|
{x: -21, y: -1},
|
|
],
|
|
],
|
|
collisionStartScript: '/assets/shit-shack/collision-start.js',
|
|
},
|
|
Position: {x: 100, y: 100},
|
|
Sprite: {
|
|
anchor: {x: 0.5, y: 0.8},
|
|
source: '/assets/shit-shack/shit-shack.json',
|
|
},
|
|
VisibleAabb: {},
|
|
});
|
|
return ecs;
|
|
}
|