???creating a tetris game???

Blender documentation projects, tutorials, translation, learning & teaching Blender

Moderators: jesterKing, stiv

perigo
Posts: 2
Joined: Thu Dec 30, 2004 7:00 am

???creating a tetris game???

Postby perigo » Thu Dec 30, 2004 7:05 am

does anyone kow how to make objects be randomly generated in a designated area like in tetris where the peices are randomly appeared in the box where they drop down?

levon
Posts: 415
Joined: Thu Jul 31, 2003 6:06 am
Location: adelaide

Postby levon » Fri Dec 31, 2004 3:39 am

i take it you are talking about the game engine????

i guess the best thing to do would be to go read some code of other tetris games made in java or C, ive seen some writen in assembly, but that wont be much help. visual basic or even old Qbasic should help as well.

an-toni
Posts: 250
Joined: Wed Mar 17, 2004 5:20 pm

Postby an-toni » Fri Dec 31, 2004 4:54 pm

there's a Tetris clone made in Python (using Pygame i.e. SDL) at http://people.jyu.fi/~shang/pytris/ (it's listed on the pygame projects page, under http://www.pygame.org)

~Toni

an-toni
Posts: 250
Joined: Wed Mar 17, 2004 5:20 pm

Postby an-toni » Fri Dec 31, 2004 4:58 pm

oh well i guess i could answer the question too, even though this is no Elysiun:

Code: Select all

import random

boxwidth = 10
xpos = random.randint(1, boxwidth)


.. assuming the first pos is 1 in your system. you probably want some grid for the box (there are plenty of Python Grid classes around, and it's simple to do yourself). oh and supposing you know your way around setting the positions etc.

hoping those helped,
~Toni

an-toni
Posts: 250
Joined: Wed Mar 17, 2004 5:20 pm

Postby an-toni » Fri Dec 31, 2004 6:14 pm

reading about something totally unrelated, happened to see this too: http://archives.seul.org/pygame/users/J ... 00074.html [pygame] learning to program tetris which goes into more detail about the data structures.

~Toni

perigo
Posts: 2
Joined: Thu Dec 30, 2004 7:00 am

Postby perigo » Wed Jan 05, 2005 5:05 am

thanks, i'll check into those info's when i get a chance, i dont know anything about programming, but i think it would be a good little project to help me learn a bit about it.


Return to “Documentation & Education”

Who is online

Users browsing this forum: No registered users and 0 guests