Blind Blocks: ~3.5 Hours In

Andrei Marks · September 9, 2011

Well, finishing up Invent with Python took a little longer than I thought, and I’m working on my tetris clone. The going is pretty slow. I’m trying to do as much of I can from scratch, without looking at how other people have handled collisions and other game design features. At the moment it just looks like this: blindblocks3.5It’s not much; I’ve got the field, basic player controls, block movement, and the block respawn in there, as well as a limited amount of collision detection. The blocks are bounded by the playing field, they can’t go through each other vertically, and I added the snap-to so that they don’t get stuck midway through other blocks or through the bottom of the field.

I think the main thing that’s holding me back is unfamiliarity with pygame’s library. I’m barely scratching the surface of all the different modules, so what’s worrying me, and what probably worries any programmer, is that there are functions that can take care of all my minor problems in a single blow. Just part of the learning process!

However, I will try to actually do more tutorial-wise today. Maybe actually implement the half-hour on, half-hour off. I can’t imagine I won’t be able to learn something from other tutorials that might help with coding the game. I just couldn’t stop trying to work things out.

Things I learned: pygame.mouse.set_visible() function, pygame.display.set_mode((x,y),pygame.Fullscreen), fonts--need to create a font object to use when we create a surface object with the image of text drawn on it, pygame.mixer.Sound, get_rect(), game loops--handling events and drawing the window while the game is running, keyboard events--always use ASCII lowercase value, move_ip() method for rect objects--mousemotion event-pos-attributes, move() method, pygame.mouse.set_pos()--moves the mouse cursor to the X adn Y coordinates passed to it, list[:], blit(), Python 2/3 differences (print() vs. print); input() vs. raw_input(), range() list of integers, "/" division, format() method

Twitter, Facebook