fix: timeout
This commit is contained in:
parent
9afb5bba81
commit
d9f5869a37
|
@ -38,7 +38,6 @@ for (let i = 0; i < N; ++i) {
|
||||||
source: '/assets/magic-swords/magic-sword-shot.json',
|
source: '/assets/magic-swords/magic-sword-shot.json',
|
||||||
},
|
},
|
||||||
Ticking: {},
|
Ticking: {},
|
||||||
Ttl: {ttl: 1.5},
|
|
||||||
VisibleAabb: {},
|
VisibleAabb: {},
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -58,7 +57,6 @@ while (shots.length > 0) {
|
||||||
spawner += elapsed;
|
spawner += elapsed;
|
||||||
if (creating.length > 0 && spawner >= EVERY) {
|
if (creating.length > 0 && spawner >= EVERY) {
|
||||||
const shot = creating.shift();
|
const shot = creating.shift();
|
||||||
shot.Ttl.elapsed = 0;
|
|
||||||
shot.Sprite.alpha = 1;
|
shot.Sprite.alpha = 1;
|
||||||
accumulated[shot.id] = 0;
|
accumulated[shot.id] = 0;
|
||||||
shots.push(shot)
|
shots.push(shot)
|
||||||
|
@ -77,9 +75,8 @@ while (shots.length > 0) {
|
||||||
)
|
)
|
||||||
shot.Speed.speed = 400;
|
shot.Speed.speed = 400;
|
||||||
shot.Direction.direction = (Math.TAU + toward) % Math.TAU;
|
shot.Direction.direction = (Math.TAU + toward) % Math.TAU;
|
||||||
if (Math.distance(where, shot.Position) < 4) {
|
if (accumulated[shot.id] > 1.5 || Math.distance(where, shot.Position) < 4) {
|
||||||
delete accumulated[shot.id];
|
delete accumulated[shot.id];
|
||||||
shot.Ttl.elapsed = 0;
|
|
||||||
shot.Sprite.alpha = 0;
|
shot.Sprite.alpha = 0;
|
||||||
ecs.destroy(shot.id);
|
ecs.destroy(shot.id);
|
||||||
destroying.push(shot);
|
destroying.push(shot);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user