Skip to content

Commit

Permalink
Pick inside the map more when WRAP is on.
Browse files Browse the repository at this point in the history
Touches #35
  • Loading branch information
derekgates committed May 5, 2012
1 parent 1de1461 commit d2ed3b8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Tanks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2813,14 +2813,20 @@ function Tank(x_init, y_init, team, type, teamnum) {
while(TooClose && attempts++ < 100) {
TooClose = false;

var quad = quadrants[i % quadrants.length];
x = rnd(quad[0], quad[1]);
y = rnd(quad[2], quad[3]);
if (WORLD_WRAP) /* choose inside the map */
{
x = rnd(BASE_HEAL_RADIUS, WIDTH - BASE_HEAL_RADIUS);
y = rnd(BASE_HEAL_RADIUS, HEIGHT - BASE_HEAL_RADIUS - (DRAW_BANNER_HEIGHT * 2));
}
else /* try to get further away */
{
var quad = quadrants[i % quadrants.length];
x = rnd(quad[0], quad[1]);
y = rnd(quad[2], quad[3]);
}

//console.log(x +", " + y);

/*x = rnd(BASE_HEAL_RADIUS, WIDTH - BASE_HEAL_RADIUS);
y = rnd(BASE_HEAL_RADIUS, HEIGHT - BASE_HEAL_RADIUS - (DRAW_BANNER_HEIGHT * 2));*/

if (x < BASE_HEAL_RADIUS) x += BASE_HEAL_RADIUS;
else if (x > WIDTH - BASE_HEAL_RADIUS) x -= BASE_HEAL_RADIUS;
Expand Down

0 comments on commit d2ed3b8

Please sign in to comment.