Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Good Java Game Tutorial

 
Keenan Staffieri
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, I know of a place called google, and I've looked over a few, but I want to know what is a good start walk-through tutorial for a first java game you think? I've seen ones for pong, ect.

But I also like to see more compelx games that are 2D of course, but you know. I do not want it to teach me applet, I want it to teach me how to program a simple game as a stand-alone application.

thank you, mightly java gods
 
Adam Nace
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is very little difference between the way you would write an applet and a stand-alone application. The main differences are: Applets are typically embedded in a web browser, and the Applet class has been outfitted with some methods that allow the Applet to interact with that web browser in a minimal way. Furthermore, you do not ahve to perform the process of creating and showing the Applet, because the borwser does this for you. It's pretty trivial anyway.

Secondly, Applets have a methods that are called by specific browser events, which are typically part of the life cycle of an Applet. Since you are not using an applet, you can basically ignore these, all except one. Should you choose to use the init() method for any reason, you will need to manually invoke the init() method just after construction. Typically, rather than using the init() method (which isn't predefined for stand-alone applications anyway), you make a method called createAndShowGUI() which basically does the same sorts of things.

The sun microsystems tutorials for Applets and Swing are good places to start to understand the differences between applets and stand-alone applications (note: the Swing tutorial essentially teaches stand-alone desktop applications).

If you're planning on doing animation, you will also want to look into the following:

  • Muli-Threading
  • Using Threads with Swing
  • 2D Graphics
  • Sound
  • Timers
  • Animation
  • More on Animation
  • And Even More on Animation
  • Full Screen Mode



  • Hope this helps.

    - Adam
     
    Larry Eisenstein
    Greenhorn
    Posts: 14
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I've been searching for the same, but there's not that many good, all-in-one sites. The book I have is Java 2 Game Programming by Thomas Petchel. It is pretty good, but very basic. You'll only read about 5 or 6 chapters and the rest just teaches the basics of Java. The good thing, is it has a lot of simple, but really good examples.

    Also, check out this link:
    http://www-static.cc.gatech.edu/classes/AY2005/cs1322_fall/HW/hw10.htm

    This is an assignment from a programming class, but its really cool. I'm sure you can google the solution.

    Other than that, I've just been downloading little Java apps from the Net and then stepping thru them on my machine.


    Hope this helps.
     
    Kino Lobo
    Greenhorn
    Posts: 20
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I want to know what is a good start walk-through tutorial for a first java game you think?


    It's not a walk-through at all, but might help:

    Killer Game Programing
     
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand
    Posts: 15302
    6
    Chrome IntelliJ IDE Mac OS X
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This series of tutorials on creating Java Space Invaders game is the best I've seen.
     
    Ernest Friedman-Hill
    author and iconoclast
    Marshal
    Pie
    Posts: 24204
    34
    Chrome Eclipse IDE Mac OS X
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That's a really nice tutorial, Gregg!
     
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand
    Posts: 15302
    6
    Chrome IntelliJ IDE Mac OS X
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Ernest Friedman-Hill:
    That's a really nice tutorial, Gregg!


    Yep, and Kevin is one super nice dude. Be sure to ping him and let him know you liked his stuff.
     
    Kevin Glass
    Greenhorn
    Posts: 4
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Well thanks for pointing my stuff out. For reference the best place to get hold of that tutorial is:

    http://www.cokeandcode.com/tutorials

    It's up to date and has considerably nicer formatting.

    Kev
    [ August 01, 2006: Message edited by: Kevin Glass ]
     
    Gregg Bolinger
    GenRocket Founder
    Ranch Hand
    Posts: 15302
    6
    Chrome IntelliJ IDE Mac OS X
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sweet, thanks Kevin.
     
    colin shuker
    Ranch Hand
    Posts: 750
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I never used the Applet class, I always extend the JApplet class.
    I'm used to working with JFrames' where I call the getContentPane() method, then add in my JPanels, or whatever.

    I consider extending JApplet similar to extending JFrame,
    but I don't think you can set a JApplets size(done in html code),
    and you dont need to bother with setVisible(true), or setLocation()
    or setDefaultCloseOperation, cause it wouldnt make sense in an applet.

    I guess you would extend Applet, if you just wanted to paint directly
    to screen, not sure if you can JPanels when extending Applet
     
    Layne Lund
    Ranch Hand
    Posts: 3061
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by colin shuker:
    I guess you would extend Applet, if you just wanted to paint directly
    to screen, not sure if you can JPanels when extending Applet


    Applet is part of the old AWT API. You would use Panel instead of JPanel if you wanted to go this route. However, I think using Swing (all the GUI classes that start with J) is the prefered method in more recent versions of Java.

    Layne
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic