FX animations - Capture the falling objects

As a continuation of my learning process, I wanted to find out What would it take to write a blocks game in FX.  Though I have not made the progress that I promised on using the FX animation loops in lieu of Swing Timer, I made little progress over capturing keyboard interactions from the user using 'onKeyDown' of the Canvas and 'KeyboardAction'. In general, it was simple & straightforward to just associate a keystroke with an operation using the KeyboardAction, for any FX widget and there are enumerated values for most of the keystrokes. The same values could be used in the 'mnemonic' attribute as well.

But some mnemonics doesn't seem to work for me. For ex, I want to use ESCAPE as a mnemonic for a 'cancel' button in a dialog whose action would be close the dialog. I am still not successful in getting this work. I need to find out if ESC keystroke is getting consumed by the top-level or by the native.

FX Blocks 

Here is a small game where objects keep falling from the top and the player has to move the cup at the bottom using keyboard/mouse capture those objects. You can configure the size of the object and the speed with which the objects reach the bottom.

(Click on the image to launch the game. You would need jdk6+) 

FX Blocks

FX Blocks Script

Next I would like to go into transformations & clipping of individual objects and groups as a whole.. Stay tuned.
 

Comments:

Nice little program. Do the falling balls move at different times because you are using the animation loops as opposed to a timer to update everything at once?

Posted by Ryan S on August 13, 2007 at 05:59 PM IST #

Not really. I have written in such a way that New balls are introduced during every alternate iterations and balls are moved in every iteration. That's why you feel as if balls are moving at different speeds.

Posted by praveen on August 14, 2007 at 10:41 AM IST #

ez

Posted by guest on May 31, 2008 at 01:13 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

mohanpraveen

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today