mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 01:31:37 +02:00
simpler loop
This commit is contained in:
parent
40aecf3bf4
commit
3fdfa1b624
1 changed files with 18 additions and 19 deletions
|
@ -61,9 +61,9 @@ Script.setInterval(function () {
|
|||
}
|
||||
|
||||
var numToCreate = RATE_PER_SECOND * (SCRIPT_INTERVAL / 1000.0);
|
||||
for (var i = 0; i < numToCreate; i++) {
|
||||
for (var i = 0; (i < numToCreate) && (totalCreated < NUMBER_TO_CREATE); i++) {
|
||||
var position = Vec3.sum(center, randomVector({ x: RANGE, y: RANGE, z: RANGE }));
|
||||
if (totalCreated < NUMBER_TO_CREATE) {
|
||||
|
||||
Vec3.print("Position: ", position);
|
||||
Entities.addEntity({
|
||||
type: TYPE,
|
||||
|
@ -80,7 +80,6 @@ Script.setInterval(function () {
|
|||
collisionsWillMove: collidable,
|
||||
lifetime: LIFETIME
|
||||
});
|
||||
}
|
||||
|
||||
totalCreated++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue