private void animate() {
		GreenfootImage back = new GreenfootImage(worldWidthInPixels, height);

		switch (direction) {
		case LEFT_TO_RIGHT:
			xPos += speed;
			break;

		case RIGHT_TO_LEFT:
			xPos -= speed;
			break;
		}

		back.drawImage(originalImage, Math.round(xPos), 0);
		setImage(back);
		time++;
		if (time == 12) {
			speed = initialSpeed;
		} else if (time > 12 && time < 130) {
			if (speed > .6f) {
				speed -= .5f;
			} else if (speed > .1f) {
				speed -= .01f;
			}
		} else if (time > 129) {
			if (speed < .5f) {
				speed += .03f;
			} else {
				speed += .5f;
			}
		}
	}