Tetris

Check out my Tetris applet at:
http://www.kornhornio.net/tetris.jsp

It saves the top 10 scores, so start competing…

Feedback is most welcome.

Nice and smooth, very good.

I discovered a bug, and was trying to nail it down, when I accidentally stole tenth position; I’m sure someone will correct this mistake pretty soon :).

The bug:

When you have a hole which you can slide something sideways into, you can actually start the slide approximately “number of pixels in a square” pixels too early. This would appear to be an out-by-one error. I’m sure you can fix it easily.

What you observe is that your pieces overlaps the one you are meant to be sliding underneath. I’m not sure, but I don’t think it lets you cheat, but it does look very weird (and wrong).

Yeah, I know about that one… the smooth-sliding pieces are a new thing I just finished, so I haven’t found a good way to solve that overlapping problem yet. Like you said, it doesn’t actually let you cheat.

Thanks for the feedback

are you actually allowed to call it Tetris?

Is the randomizer OK? I got the impression that the pieces come quite ordered… 10x the ‘T’ piece e.g.

[quote]are you actually allowed to call it Tetris?
[/quote]
I’m not sure if that’s 100% legal or whatever… Since I’m not using it to make any money, I think it might be ok, but I could be wrong. Probably should come up with some other title for it.

[quote]Is the randomizer OK? I got the impression that the pieces come quite ordered… 10x the ‘T’ piece e.g.
[/quote]
Here’s the randomizer code:

nextShape = (int) (Math.random() * NUMBER_OF_SHAPES); // 7 possible pieces

Basically you just got “lucky” :slight_smile: I’ve seen the same pieces come up 3-4 times in a row, but 10 is pretty surprising. Maybe I’ll add a check so it re-randomizes if you get the same one a certain number of times in a row.

[quote]are you actually allowed to call it Tetris?
[/quote]
Last I heard, you’re not allowed to make a ‘falling blocks’ game with a name containing the syllable ‘tris’, regardless of free/commercial. I could be wrong though.

Nice and smooth game, could do with a bit more animation when rotating and quick dropping.

about the name

http://www.geocities.com/Hollywood/2430/tetris.html

I was afraid of that… I guess it’ll be getting a name change pretty soon.

Quick-drop animation is in place now (in the code, not yet on the server where people can see it). Horizontal movement animation is next after that. I’m redesigning the way the piece/block data is stored right now because in the old version of the game (before I had smooth animation) I was only tracking grid locations, and now I need more precision control. The way it’s doing the smooth falling right now is a (bad) hack of that system.
Rotation animation is a bit further away right now, but I would like to add that eventually.

[quote]about the name

http://www.geocities.com/Hollywood/2430/tetris.html
[/quote]
Thanks for the great link!

great game.

about the name, i dont see why anyone’d want to sue you unless you started selling it.

they wouldnt sue me. i’m broke.

if i’d seen this post earlier i might have changed my posts name and maybe called my game “brickles” or something :slight_smile:

“tetris” is public domain for 1 or 2 years. it should be ok i guess :>

found a bug:

if a piece gets close to the bottom when it’s rotated laying flat then you rotate it, it’ll get stuck in the ground and no more pieces will appear.

http://members.austarmetro.com.au/~juddman/images/bug.gif

that was a reverse L piece there.

need to consider the bottom of the game board when calculating clipping of a rotating piece. i assume some of the game logic hung with an arrayIndexOutOfBounds exception which is whi no more pieces appear. the pause screen still apears if you switch to another window but can’t resume it.

[quote]found a bug:

if a piece gets close to the bottom when it’s rotated laying flat then you rotate it, it’ll get stuck in the ground and no more pieces will appear.

that was a reverse L piece there.

need to consider the bottom of the game board when calculating clipping of a rotating piece. i assume some of the game logic hung with an arrayIndexOutOfBounds exception which is whi no more pieces appear. the pause screen still apears if you switch to another window but can’t resume it.
[/quote]
Thanks for pointing that out… adding it to my list of things to do.