Connect Four!


For this next test, I wanted to try and tackle a grid-based puzzle game. My previous tests have mostly involved individual elements reacting relative to each other, but in a puzzle game, every asset must be accounted for in a larger system to determine a win. I chose to try and recreate the classic board game Connect Four. Because I never formally learned how to program and just picked up bits of pieces here and there, it took a little fumbling around to arrive at a reliable method to check for, identify, and isolate a win. I initially constructed checks based on the placed token sprite’s physical proximity to matching sprites, but quickly realized it was much easier to create a separate, abstract matrix of data (token position, type) to refer to. Looking back, the end result is deceivingly simple and it’s laughable how I thought writing an adjustable AI opponent was within reach of my current understanding. This was built in Unity for the Web and iOS. Here, I learned how to:

  • Utilize arrays to store/manage token position + type
  • Construct a “liquid” layout for multiple resolutions (Web, iPhone, Retina iPhone, iPad, Retina iPad)
  • Check for a wins across horizontal, vertical, and diagonal axes
  • Keyframe in Unity’s built in Animation Tool

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s