Computer Science Canada

the tetris game demo(or whada hell ever it's called =/)

Author:  Homer_simpson [ Wed May 07, 2003 7:15 pm ]
Post subject:  the tetris game demo(or whada hell ever it's called =/)

It took me an hour and a half to make it but it's still the demo

Author:  Homer_simpson [ Wed May 07, 2003 7:20 pm ]
Post subject: 

try changing the value of level,wide and tall it'll effect the output

Author:  Catalyst [ Wed May 07, 2003 7:26 pm ]
Post subject: 

get the actual tetris dimensions in there
and a drop button
otherwise, good so far Smile

Author:  Homer_simpson [ Wed May 07, 2003 7:35 pm ]
Post subject: 

actual tetris dimention?

Author:  Tony [ Wed May 07, 2003 7:47 pm ]
Post subject: 

he means original grid size. Its 10 cells wide and I donno how tall... Not that important, but you should keep it 10 cells wide.

Which you can actually edit in the game... just change width/height, but dont forget to adjust starting positios as well...

funny grid properties:
delay = 0
width = 1
hight = 2

just sit back and watch the points grow 8)

Author:  Homer_simpson [ Thu May 08, 2003 12:58 pm ]
Post subject: 

would u like some bits...?
well if you do solve my problem and i'll give u 200 bits!!!!!!!!!!!!
now here's my problem :
the part that should detect wheter the object has empty space under it to go down or not is giving me trouble... solve my problem and get 200 bits...

Author:  Tony [ Thu May 08, 2003 3:50 pm ]
Post subject: 

wow, this is messed up...

here's how your code should work:

for i:1..4 %check each block

grid ( piece.x(i), piece.y(i)-1) = true %if cell below has something
AND check that that cell is not a part of falling block itself

then stopFall

...

something like that

Author:  Homer_simpson [ Thu May 08, 2003 6:38 pm ]
Post subject: 

Bwaaaaaahahahhaaaaa.... i'm afraid it's not that simple tony...
you see every peace is created in a 4x2 grid
for example
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="9%" id="AutoNumber1" height="38">
<tr>
<td width="25%" bgcolor="#0000FF" height="18"></td>
<td width="25%" bgcolor="#0000FF" height="18">X</td>
<td width="25%" bgcolor="#0000FF" height="18"></td>
<td width="25%" height="18"></td>
</tr>
<tr>
<td width="25%" height="19"></td>
<td width="25%" bgcolor="#0000FF" height="19">!</td>
<td width="25%" height="19"></td>
<td width="25%" height="19"></td>
</tr>
</table>

when it gets to check the peace block(2,1) that is marked by X in the picture it'll read the block under it which is marked by ! in the picture and think that it's full under it and wont move down....

So if you could solve that problem fr me i'll give<span class="postdetails"><span style="height:40; filter:glow(color=#FFFF66, strength=10)">250</span>
BITS!!!!!!!!!!!!!!!!!!

Author:  Tony [ Thu May 08, 2003 6:44 pm ]
Post subject: 

i know... thats why I said
Quote:
AND check that that cell is not a part of falling block itself


sorry if I wasn't clear... I was refering to all the other blocks of the piece.

So if cell below is NOT a part of piece itself and is still occupied, then you hit something so stop.

Author:  Homer_simpson [ Thu May 08, 2003 6:45 pm ]
Post subject: 

how does it know that... =/

Tony gimme the turing code to my problem and i'll donate all my bits to u...

Author:  Tony [ Thu May 08, 2003 7:46 pm ]
Post subject: 

well you got your falling object set up in a weird way...

the way I programmed my tetris (i programmed a working tetris by the end of grade 10, unfortunatly I've lost the code) is that I kept my object as individual pieces located on the whole grid.

such as

objectX(1) = 5
objectY(1) = 10

so the cell @ 5,10 is taken up... same for other 3 parts...

now, the grid itself (background) is set to hold those pieces.

When it checks if it can fall down, I think it was something like this:

code:

var fall:boolean := true
for i:1..4
if grid(objectX(i),objectY(i)-1) = true AND objectY(i)-1 not= objectY(1) AND objectY(i)-1 not= objectY(2) AND objectY(i)-1 not= objectY(3) AND objectY(i)-1 not= objectY(4) then

fall := f alse

end if

end for


so basically if the cell 1 lower then any of the blocks is filled AND its not one of the 4 blocks, then you should stop the fall...

Also you got problems with moving your pieces side to side... they seem to fall appart.

Author:  Homer_simpson [ Thu May 08, 2003 7:52 pm ]
Post subject: 

mving left or right is not a problem.... it works perfectly fine...
did u say that u made a workin tetris b4?if so could u spin the peaces in it?

well it didn't exactly help me make it work and since the lazy big ass of mine is effecting my mind i'll prolly just stop here..
but + 50 bits to u tony ,thx for the help...

Author:  Tony [ Thu May 08, 2003 8:00 pm ]
Post subject: 

woot, more bits Laughing

and yes, they could spin...

though back then (remember... end of grade 10, just started programming... dont compare me to Catalyst) i did it the crapy way, manually writing a new position for each of 4 turns. Such as when you rotate, each piece moves to a new position. such as X+1, Y+2 for first piece, something else for 2nd...

now that I think of it, you could probly apply trig and rotate it around itself by 90 degrees...

Author:  Homer_simpson [ Thu May 08, 2003 8:05 pm ]
Post subject: 

bwahahahaha.... funny
yeah i was gonna make it spin 90 degrees but the lazy ass thing is kicking in again...

Author:  Tony [ Thu May 08, 2003 8:13 pm ]
Post subject: 

maybe you're better of programming color tetris... also known as columns...

its that game like tetris, but instead blocks of three colors fall and you have to get three in a row instead of whole line. The only rotation there is the order of colors.

Author:  Asok [ Thu May 08, 2003 8:15 pm ]
Post subject: 

Tony, that game is called Tetris 2 and it's available on the SNES. I strongly reccomend it to anyone actively searching bargain bins Wink

Author:  Andy [ Wed May 28, 2003 6:03 pm ]
Post subject: 

i made tettris, and its pretty simple, just use a 2d array, and store all the blocks here's my game

Author:  Homer_simpson [ Wed May 28, 2003 6:52 pm ]
Post subject: 

that's the same thing as i've done... Rolling Eyes
y dont u send yer tetris code so we can all see how it works?

Author:  Andy [ Wed May 28, 2003 8:09 pm ]
Post subject: 

its attached isn't it?
i could've made it better if i used a 3d array instead of all those procs
just set the grid #s to 1 and copy the entire grid to the actualy grid
that didn't make much sense, but anyways, yea, too lazy to change it, wasn't even for my own, did it for a friend...

Author:  Catalyst [ Wed May 28, 2003 8:11 pm ]
Post subject: 

it good, except the blocks fall too fast

Author:  Andy [ Wed May 28, 2003 8:17 pm ]
Post subject: 

just increase the delays variable at the very beginning
note: posted revised version

Author:  Homer_simpson [ Wed May 28, 2003 8:31 pm ]
Post subject: 

hmmmm.... built in shapes...!!!!! now y didn't i think of that... =/

Author:  Andy [ Wed May 28, 2003 8:43 pm ]
Post subject: 

now how about the 200 bits?
lol jk
but a couple of bits would be nice Wink

Author:  Homer_simpson [ Wed May 28, 2003 9:29 pm ]
Post subject: 

well since it's my post i think it's my duty to give u bits... but u deserver it yer program is cool Very Happy
+10 bits

Author:  Andy [ Thu May 29, 2003 7:15 am ]
Post subject: 

ahhhh, that's it? oh well, can't complain, better than nothing
thanx Wink

Author:  Maverick [ Sun Jan 11, 2004 3:45 pm ]
Post subject: 

ManKickass game. GJ!

Author:  santabruzer [ Sun Jan 11, 2004 6:56 pm ]
Post subject: 

amazing design.. not too effiecient.. but it still works fine.. just a note.. if the third line gets filled, they don't get cleared... i dunnu.. what happened exactly but a line didn't get clear... mer...


: