adjustments

This commit is contained in:
James B. Pollack 2015-12-04 15:25:55 -08:00
parent f867ebf1d1
commit b8e731fd22

View file

@ -8,7 +8,7 @@ var USE_CONSTANT_SPAWNER = true;
var RAT_SPAWNER_LOCATION = {
x: 1000.5,
y: 98,
z: 1039.5
z: 1040
};
var RAT_NEST_LOCATION = {
@ -156,6 +156,8 @@ var THIRD_AVOIDER_FINISH_POSITION = {
z: 974
};
cleanupLeftoverAvoidersBeforeStart();
var avoiders = [];
addAvoiderBlock(FIRST_AVOIDER_START_POSITION);
addAvoiderBlock(SECOND_AVOIDER_START_POSITION);
@ -178,7 +180,7 @@ function addAvoiderBlock(position) {
position: position,
collisionsWillMove: false,
ignoreForCollisions: true,
visible: true
visible: false
};
var avoider = Entities.addEntity(avoiderProperties);
@ -401,6 +403,20 @@ function getMetaRatByRat(rat) {
Entities.deletingEntity.connect(popRatFromStack);
function cleanupLeftoverAvoidersBeforeStart() {
print('CLEANING UP LEFTOVER AVOIDERS')
var nearbyEntities = Entities.findEntities(RAT_SPAWNER_LOCATION, 100);
var entityIndex;
for (entityIndex = 0; entityIndex < nearbyEntities.length; entityIndex++) {
var entityID = nearbyEntities[entityIndex];
var entityProps = Entities.getEntityProperties(entityID);
if (entityProps.name === 'Hifi-Rat-Avoider') {
Entities.deleteEntity(entityID);
}
}
}
function cleanup() {
while (rats.length > 0) {
Entities.deleteEntity(rats.pop());