May 31

Writing the JavaFX Pac-Man Game Part 3

Posted: under JavaFX, JavaFX Coding, Javafx Games.
Tags: , , , , May 31st, 2009

The latest JavaFX article of writing the Pac-Man game is published on May 28. 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. The feature of eating each other will be illustrated in next article. As before, you can try this semi-completed program by clicking Java Web Start button below:


Related Articles:

My JavaFX Demo Game: Pac-Man

Articles on Writing the JavaFX Pac-Man Game

Pac-Man Game WidgetFX Widget

JavaFX Game Example Code: MineSweeper

JavaFX Game Demo Example: Pac-Man


Other unrelated links:

Applicant of American Citizenship Information, software and guide.

Guide American Citizenship in United States

Canadian Citizenship Application and Practice Exam

Comments (0)

Nov 30

My JavaFX Demo Game: PAC-MAN

Posted: under JavaFX, Javafx Games.
Tags: , , , November 30th, 2008

UPDATE: June 30, 2009
If you are interested in how to write the Pac-Man game in JavaFX, the source code of this game, please check out this article:

How to Write the Pac-Man Game with JavaFX
or Articles on Writing the JavaFX Pac-Man Game

I spent some time to implement the classic game “PAC MAN”. It demos many features of the JavaFX language. Right now, it is a “simplified” PACMAN Game. I am working on the code and hopefully to complete the PACMAN game soon. Source code is not released yet because I plan to do so when I finish the whole game. A blog of writing this game will be available soon. Stay tuned.

Usage:
Arrow keys to move and control to pac-man to eat all dots inside the maze. The big dots are magic dots which allow the pac-man to eat ghosts.

JavaFX Features Demostrated:

  • Bindings
  • Animations
  • Effects
  • Transforms
  • Multiple inheritant
  • Java classes integration
  • Declarative statements
  • Sequences, how to map 2D arrays into a 1D Sequence
  • Handling keyboard events

JRE 1.5+ required, JRE1.6 U10 is better, it will take some time for first time launching the game …

screenshot

My JavaFX code is compatible with the newly released JavaFX 1.0. JavaFX is for Windows and Mac for now. The unofficial JavaFX SDK of Linux can be found here:
http://silveiraneto.net/2008/12/06/javafx-sdk-10-on-linux/

If you cannot play now, you can watch the video:






Unrelated links:

JavaFX Articles

Collection: NASCAR Diecast Model Cars


Canadian Citizenship Practice Test

NASCAR Car Diecast

NASCAR Drivers

British Citizenship Test for United Kingdom

Comments (32)