Frictional Games Forum

Full Version: (V1.2) Tetris: The dark descent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Totally incredible.
This looks awesome! I can't wait to see how you did it...
Thanks for the great responses guys!
Quote: If so, I think grunt sounds for a "Tetris" (Clearing 4 lines at one) would be awesome.
I can add this quite quickly, so sure, why not? There is already a grunt sound if you die, after all Wink.

Haha, it would be interesting to see just how far things could be pushed, what had to be done to just make tetris was more work than i originally though.

Quote:Epic! I just got done playing my first game and all I can say is... how?
The scripts are a tricky to follow, i will admit that. When I finalised a function (they are loosely coupled from the rest of the code) I compressed it down in vertical space a little so that each line does one "function" (so if I have two conditionals deciding a variable's state, that will be 1 line). This was done to make it less of a hassle when scrolling up and down the code, as it was beginning to take an insane amount of lines. For those who are interested in how different parts were created, though, here is an overview:
Spoiler below!
The game screen is composed of large "pixels" emulated by a box light shining onto a wall with a ceiling texture (chosen as I could alter the tile settings so each "block" of the ceiling fitted in 1 box light). Each score digits are made of a set of 10 lights (digits 0-9) and only one is active at a time for each digit.
The box lights follow the naming convention "col_[x]". Each "0-9" of x represents x coordinate, and the tens represent the y-coordinate. The digits are named "score_[digit]_[placement]" - digit is the number to display (0-9) and the placement is how far along the score this digit is. Leading 0's are chopped off with some array offset trickery.

Probably the most abstract part. Each tetris peice is stored as 4 integers (1 for each rotational state) in an array. The integers themselves are bit-feilds, with 1 corresponding to a "block" taken, and 0 corresponding to empty - this defines a 4x4 block shape in the first 16-bits of the integer. The indexes of the block-pieces in this array match up to the indexes of the colour array (offset 1) for drawing them.
Collisions are done by generating another integer in the same format as the blocks from a large map array (encodemap()), and performing a bitwise-and between the current piece and the map integer.

This is the part i came up with first, and what gave me the idea for this "story". The player is (near-pixel perfectly) surrounded by 4 script entities, which trigger depending on where he moves, and then warp him back to the start position. The player-movement speed is reduced to a 1/10th of what it originally was so the "wobbling" is less noticable.
Each script then activates a boolean variable which indicates that direction has been pressed. This is means the peices are then only checked for movement in the right phase of a fixed-speed update cycle, as opposed to whenever, and also lets me delay movement a little so blocks don't zip around uncontrollably.

Also, am working on an updated version, hopefully will be out soon - just depends how hard some scripting is to do.
(04-24-2011, 04:05 PM)ZxBrad Wrote: [ -> ]TIME FOR PAC MAN

i know what is going to be the "ghostssssssssssssss" Big Grin
Good job.

Though, that's the messied code I've ever seen.
I posted your story in my thread Big Grin
+1 vote for Pac-Man. Tongue
Version 1.1 is out. This one permits saving to maintain a highscore, and fixes a couple of bugs. Also added a grunt sound for knocking 4 pieces out at once, as was suggested by Russ Money. Code is as messy as ever though, but there always has been some indentation (or at least should be?). Anyway, this project should be finished now, aside from perhaps a bug fix update if any get found.

In other news, I think I may have an idea for my next project (a rather large undertaking) and it is going to push scripting much further than this did. Got a lot of things to test first, though.
(04-26-2011, 01:22 PM)Scraper Wrote: [ -> ]+1 vote for Pac-Man. Tongue
+1 more, Pac-Man would be srs bsns.
Pages: 1 2 3 4 5 6