Have you ever thought about creating you’re own super classic mario game, or you’re own zelda series? Well, you’re dream has come true… with SFML you’re about to create you’re first game!! To make it easy I’ve chosen to recreate the well-known game Connect Four. Ready??… Go!!

Before starting the game development be sure to have :

Let the coding start!

There are two main ways of creating this type  of games (board games).

  • By drawing directly to the screen the components of the game (circles, lines, rectangles, etc).
  • or, By using textures (images) and placing them on screen.

For the sake of this example, we’re using the first approach. We’ll be drawing a background color with circles. Three kinds of circles will make the whole : empty spaces, red tokens and yellow tokens. The outline of a winner combination (4 in a row) will be highlighted.

In the end, we’ll have a game like this:

4inARowBoard

Here you’ll find the Windows executable. And here the complete sources, including a Code::Blocks Project.

The sourcecode is released under the zlib/png license.

To be continued…