public void update(){
		key.update();
		int xa = 0;
		int ya = 0;
		
		if(knockback > 0.0f) calculateKnockback();
		animation();
		calculateBobbing();
		
		
		if(key.shift && moving){
			if(energy > 0.0f){
				if(speed < MAX_SPEED) speed += 0.05f;
				else speed = MAX_SPEED;
				float e = 0.01f + ((weight * 0.01f) + (speed * 0.01f) * 0.25f);
				if(energy - e > 0.0f) energy -= e;
				else energy = 0.0f;
			}else{
				speed = MIN_SPEED;
			}
		}else{
			if(speed > MIN_SPEED) speed -= 0.05f;
			else speed = MIN_SPEED;
			float e = 0.01f;
			if(energy + e < 100.0f) energy += e;
			else energy = 100.0f;
		}
		
		if(!moving){
			float e = 0.0175f;
			if(energy + e < 100.0f) energy += e;
			else energy = 100.0f;
		}
		
		if(attackTime > 0){
			attackTime--;
			weaponFrame++;
			speed = speed / 2;
		}
		
		if(attackTime == 0){ 
			attDir = -1;
			weaponFrame = 0;
		}
		
		if(health <= 0) setDead(true);
		
		if(key.w) ya -= speed;
		if(key.s) ya += speed;
		if(key.a) xa -= speed;
		if(key.d) xa += speed;
				
		if(attackTime == 0){
			if(key.up){
				attDir = 0;
				attackTime = 10;
			}
			if(key.right){
				attDir = 1;
				attackTime = 10;
			}
			if(key.down){
				attDir = 2;
				attackTime = 10;
			}
			if(key.left){
				attDir = 3;
				attackTime = 10;
			}
		}
		
		if(attackTime == 10){
			attack(attDir, random.nextInt(20));
			dir = attDir;
		}
		
		if(xa != 0 || ya != 0) move(xa, ya);
		else moving = false;

		tileX = (x + 16) / 32;
		tileY = (y + 16) / 32;
	}