torsdag 23 juli 2009

Done with the basics

I have completed a very rudimentary but pretty much fully functional (as far as game mechanics are concerned) version of the game! The player can move the rows of squares, and lining up three or more squares result in them disappearing. Still not even a hint of graphics or keyboard control though!

Had a bit of trouble with the function for finding lines to clear, but I managed to sort it out eventually - I was a little bit too tired to really think/care about what I was doing, which is like the height of false economy ("save a penny, spend a pound"). The code could be prettier, but never mind that, I can always clean it up later.

Architecturally I'm still pretty pleased with the program and hopefully I will manage to keep it that way - these things tend to deteriorate as time goes by ;)

Right now I think it's plausible to keep the current game pretty much as is and then build a View and a Controller on top of it, making the game the Model in a Model-View-Controller architecture. I kind of had this in mind from the beginning, and for some reason I built my "blocks falling down"-routine so that blocks would only fall down one square per update. I told myself this would be a requirement for building it as an MVC - now I can't really give a good motivation why.

Anyway, I've been playing around with this text-only version a little bit - trying to match up colours is kind of fun, but sitting here bored at work with nothing to do my perspective might be a bit warped ;)

Still haven't decided how to actually give the player a challenge - there will clearly be more blocks appearing on the playing field in some way or other, but where will they come from and when? What could trigger this terrifying torrent of trapezoids?

EDIT: Something just struck me - the game doesn't have a name yet! I encourage all visitors to this blog to leave your suggestions, and they will be subject to the most vicious sport of all - the name-a-game contest!

EDIT 2: Just checked the number of lines of code: 203 in total, which isn't too bad, especially considering half of that is probably whitespace and stuff I've commented out but never bothered to delete. So there you have it, something resembling a game in less than 200 lines of code! That's the power of Python ;)

Inga kommentarer:

Skicka en kommentar