public void animate(){
		// If we are moving right, then facing left is false
		if (dx > 0) {
			facingLeft = false;
		} else if (dx < 0) {
			facingLeft = true;
		}
		// If we aren't moving, then don't animate
		// and set frame to right facing and not moving
		// unless we are facing left, then face it left
		if (dx == 0 && !jumping){
			sprite.setImage(sprites[0]);
			if (facingLeft){
				flipImage();
			}
			return;
		}
		
		if (lastFrameChange > frameDuration){
			// reset our frame change time counter
			lastFrameChange = 0;
			// update the frame
			currentFrame++;
			if (currentFrame >= sprites.length){
				currentFrame = 0;
			}
			
			// If we are facing to the left, flip the image
			if (facingLeft) {
				sprite.setImage(sprites[currentFrame]);
				flipImage();
			}
			else if (!facingLeft){
				System.out.println("facing right");
				sprite.setImage(sprites[currentFrame]);
				return;
			}	    
		}
	}