fix: atomic tomatoes
This commit is contained in:
parent
0588dbf6c2
commit
b5019153f3
|
@ -1,11 +1,11 @@
|
|||
const {Interactive, Position, Plant, Sprite} = subject;
|
||||
Interactive.interacting = false;
|
||||
Plant.stage = 4;
|
||||
Sprite.animation = ['stage', Plant.stage].join('/')
|
||||
|
||||
const promises = [];
|
||||
|
||||
for (let i = 0; i < 10; ++i) {
|
||||
|
||||
const tomato = ecs.get(await ecs.create({
|
||||
promises.push(ecs.create({
|
||||
Collider: {
|
||||
bodies: [
|
||||
{
|
||||
|
@ -42,6 +42,12 @@ for (let i = 0; i < 10; ++i) {
|
|||
VisibleAabb: {},
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
const ids = await Promise.all(promises);
|
||||
for (const id of ids) {
|
||||
const tomato = ecs.get(id);
|
||||
|
||||
const {x, y} = Math.normalizeVector({
|
||||
x: (Math.random() * 2) - 1,
|
||||
y: (Math.random() * 2) - 1,
|
||||
|
@ -113,6 +119,7 @@ for (let i = 0; i < 10; ++i) {
|
|||
).promise,
|
||||
]),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Plant.stage = 4;
|
||||
Sprite.animation = ['stage', Plant.stage].join('/')
|
||||
|
|
Loading…
Reference in New Issue
Block a user