@Override
	public void run() {
		
		if (gameState != GameState.RUNNING) {
			return;
		}
		
		while (true) {
			robot.update();
			if (robot.isJumped()) {
				currentSprite = getImage(CharacterType.CHARACTER_JUMPED);
			}
			// sprite update to 'ducked' is handled in onKeyDown
			else if (!robot.isDucked()) {
				currentSprite = anim.getImage();
			}
		
			Iterator<Projectile> iter = robot.getProjectiles().iterator();
			
			while (iter.hasNext()) {
				Projectile p = iter.next();
				if (p.isVisible()) {
					p.update();
				} 
				else {
					iter.remove();
				}
			}
			updateTiles();
			hb.update();
			hb2.update();
			bg1.update();
			bg2.update();
			animate();
			repaint();
			try {
				Thread.sleep(17);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if (robot.getCenterY() > VISIBILITY_EDGE) {
				gameState = GameState.DEAD;
			}
		}
	}