A Lights Out Game

When it comes to “Getting Started” tutorials one can’t really have enough of them. With that in mind, here’s another GUI application tutorial for Dolphin’s MVP framework. This time the aim is to create a simple game called “Lights Out”. Those of you who have come from a Pharo Smalltalk background may recognize it as an example from the Pharo By Example book. Our version is quite different, however, because here we use Model-View-Presenter as our GUI framework.

Part 1: Introduction. This 5 minute video demonstrates an example of the game we are going to create and explain the structure of the various components involved.



Part 2: Creating the LightsOutCell presenter and LightsOutCellView.
In this 12 minute section we see how to create the MVP triad for the LightsOutCell component, which is used to display each cell on the game board.



Part 3: Creating the LightsOutBoard model and the LightsOutGame presenter. Here we build the model for the game board and the top level presenter for the game itself. Because the game can have a variable size playing field we will show how to dynamically create presenter components as the game window is opened. This 14 minute video takes us to the point where we can get the game board up on screen.



Part 4: Finishing Off. In this final 15 minute section we see how to complete the coding for the game in a rather novel way; by coding the missing pieces directly from within Dolphin’s debugger. Once complete, we load an icon image for the game class from a PNG file and then install it into the Dolphin samples folder.

blog comments powered by Disqus