~ PHYSICS VARIABLES~
int height = 200;
int minY = 50;
int maxY = minY + height;
int minX = 100;
int maxX = 100;
int velocityY = 1;
int velocityX = 1;

~ BACKGROUND ~
int bgCounter = 474;

~ H ~
rect hLeft = minX, minY, 30, height, red;
rect hMiddle = minX, minY + 85, 90, 30, red;
rect hRight = minX + 60, minY, 30, height, red;

~ E ~
rect eLeft = minX + 100, minY, 30, height, (255, 127, 0);
rect eTop = minX + 100, minY, 90, 30, (255, 127, 0);
rect eMiddle = minX + 100, minY + 85, 90, 30, (255, 127, 0);
rect eBottom = minX + 100, maxY - 30, 90, 30, (255, 127, 0);

~ L ~
rect firstLLeft = minX + 200, minY, 30, height, (255, 255, 0);
rect firstLBottom = minX + 200, maxY - 30, 90, 30, (255, 255, 0);

~ L ~
rect secondLLeft = minX + 300, minY, 30, height, green;
rect secondLBottom = minX + 300, maxY - 30, 90, 30, green;

~ O ~
ellipse oOuter = minX + 400, minY, 90, height, blue;
ellipse oInner = minX + 430, minY + 30, 30, height - 60, (236, 236, 236);

drawloop {
	velocityY = velocityY + 1;

	~ Bounce HELLO if it is at the bottom of the screen and make it stick a bit ~
	if (hLeft.y + hLeft.height >= 700) {
		if (velocityY > 30) {
			velocityY = 30;
		}
		velocityY = velocityY - 2 * velocityY;
	}

	~ Horizontal motion ~
	if (oOuter.x + oOuter.width >= 700) {
		velocityX = -1;
	} else if (hLeft.x <= 0) {
		velocityX = 1;
	}

	run updatePositions;
	run updateBackgroundColor;
}

~ Updates shape positions ~
block updatePositions {
	put hLeft at hLeft.x + velocityX, hLeft.y + velocityY;
	put hMiddle at hMiddle.x + velocityX, hMiddle.y + velocityY;
	put hRight at hRight.x + velocityX, hRight.y + velocityY;

	put eLeft at eLeft.x + velocityX, eLeft.y + velocityY;
	put eTop at eTop.x + velocityX, eTop.y + velocityY;
	put eMiddle at eMiddle.x + velocityX, eMiddle.y + velocityY;
	put eBottom at eBottom.x + velocityX, eBottom.y + velocityY;

	put firstLLeft at firstLLeft.x + velocityX, firstLLeft.y + velocityY;
	put firstLBottom at firstLBottom.x + velocityX, firstLBottom.y + velocityY;

	put secondLLeft at secondLLeft.x + velocityX, secondLLeft.y + velocityY;
	put secondLBottom at secondLBottom.x + velocityX, secondLBottom.y + velocityY;

	put oOuter at oOuter.x + velocityX, oOuter.y + velocityY;
	put oInner at oInner.x + velocityX, oInner.y + velocityY;
}

~ Updates the background color ~
block updateBackgroundColor {
	~ Set the background color ~
	if (bgCounter > 575) {
		background red;
		oInner.color = red;
	} else if (bgCounter > 550) {
		background (255, 127, 0);
		oInner.color = (255, 127, 0);
	} else if (bgCounter > 520) {
		background (255, 255, 0);
		oInner.color = (255, 255, 0);
	} else if (bgCounter > 500) {
		background green;
		oInner.color = green;
	} else if (bgCounter > 475) {
		background blue;
		oInner.color = blue;
	} else {
		background (236, 236, 236);
		oInner.color = (236, 236, 236);
	}

	~ Decrement bgCounter 600 -> 0 and then back to 600 ~
	if (bgCounter < 0) {
		bgCounter = 600;
	} else {
		bgCounter = bgCounter - 1;
	}
}
