protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
public static int random( int a, int b ) { return interpolate( a, b, Random.Float() ); }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }
protected final Point getDoorCenter(){ PointF doorCenter = new PointF(0, 0); for (Door door : connected.values()) { doorCenter.x += door.x; doorCenter.y += door.y; } Point c = new Point((int)doorCenter.x / connected.size(), (int)doorCenter.y / connected.size()); if (Random.Float() < doorCenter.x % 1) c.x++; if (Random.Float() < doorCenter.y % 1) c.y++; c.x = (int) GameMath.gate(left+2, c.x, right-2); c.y = (int)GameMath.gate(top+2, c.y, bottom-2); return c; }