This repository was archived by the owner on Jan 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
This repository was archived by the owner on Jan 27, 2021. It is now read-only.
Tents stuck in a bunch #5
Copy link
Copy link
Open
Labels
Description
When the player has two or more tents, they will merge into a bunch.
This is not desired, I would prefer each tent not be inside any other, and if they do they should automatically correct themselves.
The current code for correcting this is:
for(var j=0; j<player.tents.length; j++) {
if(j != i && player.tents[i] !== undefined) {
var distance = Math.sqrt(Math.pow(player.tents[j].y-player.tents[i].y,2) + Math.pow(player.tents[j].x-player.tents[i].x,2));
var radiusTotal = (player.tents[i].radius + player.tents[j].radius);
if(distance < radiusTotal) {
//if(player.lastSplit > new Date().getTime() - 1000 * c.mergeTimer) { //Not merging.
if(player.tents[i].x < player.tents[j].x) {
player.tents[i].x--;
} else if(player.tents[i].x > player.tents[j].x) {
player.tents[i].x++;
}
if(player.tents[i].y < player.tents[j].y) {
player.tents[i].y--;
} else if((player.tents[i].y > player.tents[j].y)) {
player.tents[i].y++;
}
//}
/*else if(distance < radiusTotal / 1.75) { //Merge into one.
player.tents[i].mass += player.tents[j].mass;
player.tents[i].radius = util.massToRadius(player.tents[i].mass);
player.tents.splice(j, 1);
}*/
}
}
}From my tests I believe they ARE correcting themselves, but this is being undone somehow.
Any help would be appreciated. Thanks!
Edit
The bug was invoked by this commit: Alter the laws of physics
