All the Interesting Things

This is a personal web log. All information posted here does not represent my employer. I do not speak for my employer.
Thursday May 28, 2009

3rd Article on Writing the JavaFX Pac-Man Game

The latest JavaFX article of writing the Pac-Man game is published today. It is the third out of a five-article series: "Writing the Pac-Man Game in JavaFX - Part 3".

In this article, the ghosts are introduced. The animation of the ghosts are almost the same as the Pac-Man character. It is basically moving a CustomNode and switching the images. There are three sets of images for the animation: normal, hollow and flashing. The moving algorithm of the ghosts is the heart of the code. In this article, for simplicity, a random moving algorithm is applied. A more complicated moving behavior of the ghosts will be introduced in Article 5. Click on the below image to try the program so far. The Pac-man and ghosts cannot eat each other even they meet in the maze.



Related Articles:

Pac-Man Game WidgetFX Widget
JavaFX Game Example Code: MineSweeper
JavaFX Game Demo Example: Pac-Man

Other links:

Applicant of American Citizenship Information, software and guide.
Guide American Citizenship in United States
Canadian Citizenship Application and Practice Exam
Haining Zhang

Thursday May 21, 2009

Second Article on Writing the JavaFX Pac-Man Game Published

The second article of a series, "Writing the Pac-Man Game in JavaFX - Part 2", is published today.

In the first article, I introduced a data model expressed in Java and the JavaFX drawing logic of the maze. In the 2nd article, the animation of the Pac-Man character is detailed. When you are reading, you can click on the java web start links to see the Pac-Man opening and closing mouths, and gradually moving inside the maze. The keyboard handling logic is introduced as well.

Some JavaFX features demostrated in these two articles include:

. shapes
. animation
. keyboard handling
. java code integration
. Transfromation

Hope you can enjoy reading the articles. You can use arrow keys to control the Pac-Man character to move around and gobble dots. Try the never-to-die version of the game by clicking the below screenshot:

click to run

click to run


Other Related Articles:
Develop Games in JavaFX
JavaFX Blogs: Tips, Tricks, Programming Sample Code
My JavaFX Demo Game: Pac-Man

Monday May 18, 2009

JavaFX Demo Program: Wish Tree

To give some fun to my kids, I wrote a small JavaFX program to let them make wishes on a wish tree( such as 'I want a Barbie'). If they do something good, they may be awarded a wish coming true. :)

This program uses effect classes of JavaFX API to create the scene. Colorful stars can be placed on the tree to stand for wishes. More details inlcluding source code of the program can be found here: JavaFX Wish Tree.

You can click on the below web start image to start placing your wishes on the tree now. Just click on the tree and enter your name and wishes. Enjoy! (JDK 1.5+, better with JDK 1.6 U10)

Click to start JavaFX Wish Tree

Click to start JavaFX Wish Tree

Click to start JavaFX Wish Tree



Other Posts of JavaFX:
Wish Tree in JavaFX
Writing the Pac-Man Game with JavaFX
JavaFX Game Sample Code
JavaFX例子、实例、编程和源程序
JavaFX Guy的技术、教程、博客
Haining Zhang

Saturday May 16, 2009

Five Articles on JavaFX Pac-Man Game

After I wrote a Pac-Man game using the JavaFX API, many people were quite interested in the game. They either enjoyed playing it or asked me for the details fo the JavaFX code. JavaFX expert Jim Weaver invited me to write some articles about the process of building the game. After a few weeks' hard work, with Jim's constructive ideas and great help in proofreading, I finished the articles. Now they are published on insideRIA.com, an O'Reilly's web site, as featured articles. There will be 5 articles in total and they will run through the coming 5 weeks.

In each article, there are a few web start links that you can click on and start a JavaFX program to see how it works. If you follow the 5 articles, you will find out how the game is built bit by bit. I hope the articles can help people who want to learn JavaFX or want to develop games in JavaFX.

Here is the links for the articles:

May 14, 2009: Writing the Pac-Man Game in JavaFX - Part 1
May 21, 2009: Writing the Pac-Man Game in JavaFX - Part 2
May 28, 2009: Writing the Pac-Man Game in JavaFX - Part 3
June 4, 2009: Writing the Pac-Man Game in JavaFX - Part 4
June 11, 2009: Writing the Pac-Man Game in JavaFX - Part 5

Related articles:
My JavaFX Demo Game: PACMAN
JavaFX Demo Game: PAC-MAN
JavaFX Game
JavaFX Wish Tree
JavaFX

Thursday May 14, 2009

My Articles on Writing the Pac-Man Game in JavaFX

After I wrote the Pac-Man game with JavaFX, many people were asking me to give more details on writing the game. JavaFX guru Jim Weaver had invited me to write some articles on the game. Now, with Jim's help, our articles are featured on O'Reilly's insiderRIA.com . Here is the link to the articles:

Writing the Pac-Man Game in JavaFX


Archives
Links
Referrers