Showing posts with label Tetris. Show all posts
Showing posts with label Tetris. Show all posts

Sunday, 22 February 2009

Tetris and Maze

I'm currently busy extending the Tetris application with some visual's, more features like highscores, levels etc.
I come back to that because I found some nice things with the NSImage class.

I'm also busy with a Maze application, the purpose will be to escape a maze using the SMS (so this will be for Macbook  and Powerbook only).

Friday, 13 February 2009

Tetris : the implementation of a classical game in Objective-C/Cocoa

First of all the source code of the game can be found here. Background for the game can be found on wikipedia.

This implementation is a first attempt to implement it, in this version I was more intrested to get it to work than in the nice graphical aspects.
As you can see in the picture , it surely won't win a prize as the most sexy application :-).



This game again is an implementation of the classical MVC design pattern, with the difference that their are 2 views.

The model is a TetrisBoard (subclass of Board) on which you can move a piece (the so-called Tetrominoe (superclass of a set of pieces)).
The tetrominoe is the abstract superclass of all the tetrominoe's. It's very handy to model the pieces as a class, later on I can add things like a skin, or a another way of rotating. 

There are 2 views, the TetrisView and the TetrominoeView. The first one is the graphical representation of the  TetrisBoard; the second shows the next tetrominoe.

The model and the view(s) are connected via the TetrisController.