Jim has posted 66 posts at DZone. You can read more from them at their website. View Full User Profile

Watch for Falling Blocks: Take TetrisJFX for a Spin!

05.01.2008
| 3694 views |
  • submit to reddit

You may know that I've been progressively building a Tetris game in JavaFX on this blog, the most recent post being Game Over: Improving upon the Compiled JavaFX Tetris Program.  In each post I've shown you the code and pointed out some highlights.  Since then I've added some finishing touches, and would be honored if you've try it out and give me (kind) feedback for improving it further.  The screenshot below shows what TetrisJFX should look like when you click this Java Web Start link.  By the way, you'll need the JRE (Java Runtime Environment) 1.5 or later.  Also, please keep in mind that the JavaFX Script JAR files will be included with the JRE at some point. Until then please understand that when you click this link those JAR files will be downloaded as well, causing a bit of a delay.

Tetrisjfx_w_image_buttons

In addition to clicking the image buttons at the bottom of the game, you can use keystrokes (hover over the images to see tooltips that tell you what the keystrokes are).  In a future version, the arrow keys will be used for game control.  I also plan to provide the ability to cause the current tetromino to fall faster.  By the way, the tetrominoes fall progressively faster as your score increases, so be warned. :-)

170x93_speaker_v4_4 If you have any questions or input for improvements, please post a comment.  Also, if you'll be at JavaOne 2008, please attend my JavaFX Script Programming Language Tutorial session and introduce yourself afterward!

 

Have fun!
Jim Weaver
JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications

Immediate eBook (PDF) download available at the book's Apress site

Published at DZone with permission of its author, Jim Weaver.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Carl Antaki replied on Thu, 2008/05/01 - 11:59am

Hi Jim, I like it it's pretty fun. It would be good to have the game resize and fill the entire frame upon resize. Also a pause would be good and the keyboard controls would be essential to add.

Carl

Jose Smith replied on Thu, 2008/05/01 - 4:24pm

The rotate buttons sticks out like a sore thumb due to aliasing.  It could just be the font, but the S and C in "SCORE" look a bit aliased too.

Anyway, as someone who knows absolutely nothing about JavaFX, can you state in a few sentences what exactly is the advantage of using JavaFX for this type of thing?

Jacek Furmankiewicz replied on Fri, 2008/05/02 - 7:04am

One thing that bugs me about JavaFX is your closing bracket hell... 

                   }
                }
              ]
            }
        }
      ]
    }

 

Jim Weaver replied on Sat, 2008/05/03 - 8:59pm in response to: Jose Smith

[quote=jonj]

The rotate buttons sticks out like a sore thumb due to aliasing.  It could just be the font, but the S and C in "SCORE" look a bit aliased too.

Anyway, as someone who knows absolutely nothing about JavaFX, can you state in a few sentences what exactly is the advantage of using JavaFX for this type of thing?

[/quote]

Thanks for you graphics input.  I asked a professional designer to make some buttons, and the screenshot reflects what you'll see when you play the game.  

Advantages of using JavaFX for client-side programming is that it uses a simple, declarative syntax, and you can use Java classes directly.  There is a built-in binding to a model capability that really facilitates the declarative scripting approach.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.