Sectors/Health is Working

This was more challenging than the prior parts, but I have sectors working properly, including the joints between them and allowing the player to move the head of the program through its own sectors, which was a difficult mechanic to get right. Obligatory video:

I did this by storing the position of each sector in an array, in chronological order. It pops the last sector from the list if the length of the array is greater that the maximum program size.

For the joints/squares that connect each sector in the same program, I iterate through each sector position and, if two squares are adjacent in a row or column, draw a translucent rectangle between them. With every move, I clear them and redraw them. There might be a more efficient way to do it, but I couldn’t be bothered to work it out.

One thought on “Sectors/Health is Working

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s