@Override
	public void run() {
		while (true) {

			for (int i = 0; i < tilearray.size(); i++) {
				Tile t = tilearray.get(i);
				t.update();
			}

			robot.update();

			if (robot.isJumping() == false && robot.isDucking() == false)
				currentSprite = anim.getImage();
			else if (robot.isJumping())
				currentSprite = characterJumped;
			else if (robot.isDucking())
				currentSprite = characterDown;

			ArrayList projectiles = robot.getProjectiles();
			for (int i = 0; i < projectiles.size(); i++) {
				Projectile p = (Projectile) projectiles.get(i);
				if (p.isVisible())
					p.update();
				else
					projectiles.remove(i);

			}

			hb1.update();
			hb2.update();
			bg1.update();
			bg2.update();

			animate();
			repaint();
			try {
				Thread.sleep(17);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}

		}
	}