My JavaFX Demo Game: PAC-MAN

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

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

32 Comments

  • Comment by Silveira Neto — December 6, 2008 @ 1:44 am

    1

    Cool! I played it here.


  • Comment by Andrew McVeigh — December 9, 2008 @ 2:36 am

    2

    great demo. finally a javafx demo that isn’t horrible!


  • Comment by shaman666 — December 10, 2008 @ 1:01 pm

    3

    Congratulations! Great game!


  • Comment by Steve Muench — December 10, 2008 @ 1:13 pm

    4

    Is there any way to play it right in the page like the Flash games I see my kids play? Having the end-user see *.jnlp extensions in Firefox download dialogs is a cold shower for non-technical users.


  • Comment by Roger Padilla — December 10, 2008 @ 1:27 pm

    5

    Simply wonderful. Thanks by share your great work.

    Greetings from Cartagena/Colombia


  • Comment by Chad Stever — December 10, 2008 @ 1:55 pm

    6

    awesome


  • Comment by HighScore — December 10, 2008 @ 2:38 pm

    7

    Are planning to include a high score server?


  • Comment by bein — December 10, 2008 @ 3:34 pm

    8

    hi, great work, will be cool if share your code, i’m start with javafx, and i think is great. Good day.


  • Comment by Stephan — December 10, 2008 @ 3:41 pm

    9

    Very cool. I love it :)


  • Comment by mewondering — December 10, 2008 @ 9:40 pm

    10

    do you dubble buffer or is that part of fx?


  • Comment by Henry — December 11, 2008 @ 1:20 am

    11

    Dear mewondering,

    I did not use any double buffering in the code, the JavaFX takes care of the animation.


  • Comment by Henry — December 11, 2008 @ 1:23 am

    12

    Dear Steve Muench,

    It seems that IE doesn’t show up the .jnlp URL. Anyway, you can see a html version here:

    http://www.compare-review-information.com/pacman.html


  • Comment by Jim — December 11, 2008 @ 1:53 am

    13

    Great work - one of the best JavaFX apps so far.


  • Comment by Sravan — December 11, 2008 @ 4:55 am

    14

    Thanks for the game. Pacman is always welcome. :)


  • Comment by wildboar — December 11, 2008 @ 6:25 am

    15

    Nice one Henry. Can’t wait to gobble up the code.


  • Comment by Prashant Saraf — December 11, 2008 @ 6:56 am

    16

    Coolll.. JavaFX rocks..


  • Pingback by Sun JavaFX 1.0 Released — December 11, 2008 @ 7:01 am

    17

    [...] a penalty for missing the news, I share with you Henry Zhang’s JavaFX implementation of the Pacman game. [...]


  • Comment by David — December 11, 2008 @ 9:59 am

    18

    Great game! Is there source code that we can look at, to see how you did your animations, sequences, etc?


  • Comment by Deniz Oguz — December 11, 2008 @ 1:43 pm

    19

    one of the best javafx games so far.


  • Comment by Christine Dorffi — December 12, 2008 @ 11:05 am

    20

    We are covering this blog on the JavaFX Developer Home page this week: . Looking forward to the next phase.


  • Pingback by » My JavaFX Demo Game: PACMAN »Free Games — December 12, 2008 @ 12:04 pm

    21

    [...] games by unknown « Armada The Final Assault download from Action category Snow Man Online Coloring [...]


  • Comment by Licsan — December 13, 2008 @ 6:14 pm

    22

    Hey!
    waw, nice game! Good work, I’m really looking forward to see the source of this. Just one question : I think there is no sound in the game, right?
    Is there any possibility to do this with JavaFX, or isn’t it the subject at all?
    Sorry, I’m just trying to figure out what exactly brings JFX, so I apologize if my question is stupid…
    Except that, it’s brillant! ;)


  • Comment by Henry Zhang — December 14, 2008 @ 12:49 am

    23

    hi Licsan,

    Thanks for your comment. JavaFX does support sound. I just need some time to put it into the game. Have fun!


  • Comment by Geert Schuring — December 16, 2008 @ 7:07 am

    24

    Where are the cherries?


  • Comment by Amer Sohail — December 17, 2008 @ 10:29 pm

    25

    Cool Demo. Waiting for source code


  • Comment by Eric Groleau — December 19, 2008 @ 9:54 pm

    26

    Very good result! I am anxious to look at the code.

    Do you have an idea of how long it is going to take you to publish your code?

    Thank you.


  • Comment by Raj — December 20, 2008 @ 12:46 pm

    27

    Hey i’m relatively new to programming. I am in a java computer programming 1 class right now. Being able to view this code would be greatly useful. Any chance this could be possible?


  • Comment by mogulwraith — December 27, 2008 @ 6:57 pm

    28

    nice. Can’t go wrong with Pac-Man. I did miss the familiar Wocka-Wocka-Wocka sounds though.

    Hi mogulwraith,

    I am planning to add in audio of this game. Just that need to spare some time in coding and find a suitable sound track of the Wocka-Wocka …. :)

    Henry


  • Comment by lestasi_delloro — December 27, 2008 @ 7:28 pm

    29

    Great work…

    And i was wondering if it is possible to use JavaFX Script code integrated with pure Java code. Can i provide these new design issues to my Java code? Is there any technical articles on this subject you may recommend?

    Hi lestasi_delloro,

    JavaFX can call Java without any problem. If you want to call JavaFX from Java, there may be some work. Please refer to my other post for details: http://www.compare-review-information.com/javafx-java-interoperability/

    Henry


  • Comment by Lobochief — December 29, 2008 @ 12:49 pm

    30

    That’s remarkably well done, similar to the original. Do you plan to release the source code, or at least allow redistribution?

    Dear lobochief,

    Thanks for your comment. I am working on some articles about this game. The source code will be released as well. Please check back some time later. Thanks.

    Henry


  • Comment by Jeet Kaul — January 1, 2009 @ 7:40 pm

    31

    Very nice work. I had fun. Hope you will be doing more of these.


  • Pingback by Articles on Writing the JavaFX Pac-Man Game — May 16, 2009 @ 7:51 am

    32

    [...] My JavaFX Demo Game: PACMAN [...]


RSS feed for comments on this post.