public void update() {
		
		getNextPosition();
		checkTileMapCollision();
		setPosition(xtemp, ytemp);
		
		//check flinching
		if(flinching) {
			long elapsed = (System.nanoTime() - flinchTimer) / 1000000;
			if(elapsed > 400) {
				flinching = false;
			}
		}
		
		// if hits a wall, go other direction
		if(facingRight && dx == 0) {
			facingRight = false;
		} else if(!facingRight && dx == 0) {
			facingRight = true;
		}
		
		// update animation
		animation.update();
	}