chore: some flower barrels :3
This commit is contained in:
parent
acdc3f1924
commit
d959dcdacf
BIN
resource/flower-barrel.png
Normal file
BIN
resource/flower-barrel.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
|
@ -24,6 +24,14 @@ const entityList = new EntityList();
|
||||||
const stateSynchronizer = new StateSynchronizer({
|
const stateSynchronizer = new StateSynchronizer({
|
||||||
entityList,
|
entityList,
|
||||||
});
|
});
|
||||||
|
setImmediate(() => {
|
||||||
|
for (let i = 0; i < 20; ++i) {
|
||||||
|
const x = Math.floor(Math.random() * 1000) + 100;
|
||||||
|
const y = Math.floor(Math.random() * 500) + 100;
|
||||||
|
const flowerBarrel = createFlowerBarrelEntity([x, y]);
|
||||||
|
entityList.addEntity(flowerBarrel);
|
||||||
|
}
|
||||||
|
});
|
||||||
// Connection listener.
|
// Connection listener.
|
||||||
function createConnectionListener(avocadoServer) {
|
function createConnectionListener(avocadoServer) {
|
||||||
return (socket) => {
|
return (socket) => {
|
||||||
|
@ -115,6 +123,32 @@ function createEntityForConnection() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// Create a flower barrel.
|
||||||
|
function createFlowerBarrelEntity(position) {
|
||||||
|
const entity = createEntity();
|
||||||
|
return entity.fromJSON({
|
||||||
|
traits: {
|
||||||
|
pictured: {
|
||||||
|
params: {
|
||||||
|
images: {
|
||||||
|
initial: {
|
||||||
|
offset: [0, -32],
|
||||||
|
uri: '/flower-barrel.png',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
existent: {},
|
||||||
|
graphical: {},
|
||||||
|
positioned: {
|
||||||
|
state: {
|
||||||
|
x: position[0],
|
||||||
|
y: position[1],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
// Main loop.
|
// Main loop.
|
||||||
let lastTime = performance.now();
|
let lastTime = performance.now();
|
||||||
function createMainLoop(avocadoServer) {
|
function createMainLoop(avocadoServer) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user