public void updateLogic() {
		if (shouldMoveEnemy) {
			Rectangle2D rect = selectedEnemy.getRect();
			Rectangle2D oldRect = new Rectangle2D.Double(rect.getX(),
					rect.getY(), rect.getWidth(), rect.getHeight());
			selectedEnemy.move();
			if (selectedEnemy.wallCollision() || selectedEnemy.playerCollision(tanks)) {
				selectedEnemy.setRect(oldRect);
			}
			
		}
		if (shouldMove) {
			if (selected != null) {
				Rectangle2D rect = selected.getRect();
				Rectangle2D oldRect = new Rectangle2D.Double(rect.getX(),
						rect.getY(), rect.getWidth(), rect.getHeight());
				selected.move();
				// if there is a collision than roll back the movement
				if (playerCollision()) {
					
					selected.setRect(oldRect);
					return;
				}
				if (wallCollision()) {
					selected.setRect(oldRect);
					return;
				}
				flagCollision();
				
				//new MessageSender("M " + selected.getId() + " " + dirString.get(selected.getDirection())).start();
			}
			repaint();
		}
		for (Tank t : tanks) {
			t.gameTick();
			toRemove.clear();
			ArrayList<Bullet> toRemove = bulletCollision(t.bullets);
			t.bullets.removeAll(toRemove);
		}
		for (Tank t : enemyTanks) {
			t.gameTick();
			toRemove.clear();
			ArrayList<Bullet> toRemove = bulletCollision(t.bullets);
			t.bullets.removeAll(toRemove);
		}
		checkForHitByEnemy();
	}