@Override
	public void update(int delta) {
		super.update(delta);
		container = new Container(id, x, y);
		DOServer.server.sendToAllUDP(container);

		if (!areThereAnyDoses())
			destroy();

		changeDirectionTimeout -= delta;
		attackTimeout -= delta;

		shootOnDos();

		if (changeDirectionTimeout <= 0) {
			newVelocity();
			changeDirectionTimeout = CHANGE_DIRECTION_TIME;
		}

		x += direction.x * speed;
		y += direction.y * speed;

		Dos someDos = (Dos) collide(x, y, "Dos");
		if (someDos != null)
			someDos.life = 0; // No one can touch the FSM and stay alive!
		Entity starOfDavidColl = collide(x, y, "Star of David");
		if (starOfDavidColl != null) // Star of David hit the FSM
		{
			starOfDavidColl.destroy();
			life--;

			newVelocity(); // change direction and speed

			if (life == 0) {
				((StarOfDavid) starOfDavidColl).getShootingDos().score += 10;
				this.destroy();
			}
		}

		if (x < DOServer.LEFT_BORDER
			|| x + width > DOServer.RIGHT_BORDER)
			direction.x *= -1;

		if (y < DOServer.TOP_BORDER
			|| y + height > DOServer.BOTTOM_BORDER)
			direction.y *= -1;
	}