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',
|
||||
},
|
||||
Ticking: {},
|
||||
Ttl: {ttl: 1.5},
|
||||
VisibleAabb: {},
|
||||
}));
|
||||
}
|
||||
|
@ -58,7 +57,6 @@ while (shots.length > 0) {
|
|||
spawner += elapsed;
|
||||
if (creating.length > 0 && spawner >= EVERY) {
|
||||
const shot = creating.shift();
|
||||
shot.Ttl.elapsed = 0;
|
||||
shot.Sprite.alpha = 1;
|
||||
accumulated[shot.id] = 0;
|
||||
shots.push(shot)
|
||||
|
@ -77,9 +75,8 @@ while (shots.length > 0) {
|
|||
)
|
||||
shot.Speed.speed = 400;
|
||||
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];
|
||||
shot.Ttl.elapsed = 0;
|
||||
shot.Sprite.alpha = 0;
|
||||
ecs.destroy(shot.id);
|
||||
destroying.push(shot);
|
||||
|
|
Loading…
Reference in New Issue
Block a user