Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By gimbal2

Thread: using images on java

  1. #1
    ShadowWalker is offline Member
    Join Date
    Mar 2013
    Location
    Greece
    Posts
    96
    Rep Power
    0

    Default using images on java

    Hello all! i have decide to create a small mini version of super mario game.. and first i search for the icons and again i see a lot of people use something like this : using images on java-g0.png
    to load icons (images) into the game.. but how is that possible anyway.. i know how to put images on a label, on a button etc... or to draw something into the JFrame but how is possible for someone to take only i piece from the entire image each time..and this is happening not only in mario game.. but in every game i search for info.. i really need to buy a game programming book.. my book is very old :P

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: using images on java

    That is called a spritesheet, which is already enough information for you to Google for days. There are two basic ways to use them:

    - keep the spritesheet as it is and draw only that part of it which represents the sprite/frame you want to draw
    - while loading the spritesheet, extract the individial sprites / frames as mini images

    If you use a framework (and you should, check out LibGDX) then spritesheet support is probably built in.

    Also note that there aren't any real recent Java game programming books, game programming is more the area of C++/C# so most books will use those language as their base. You are best off buying a popular game programming book regardless of the language it uses and simply adapt the information in it to Java, which should be easier than it sounds in the context of game programming.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    ShadowWalker is offline Member
    Join Date
    Mar 2013
    Location
    Greece
    Posts
    96
    Rep Power
    0

    Default Re: using images on java

    Thx you for the info!! now let's google it ;) i have a lot of time ;) !! yeah i know that java is actually slower that C++ or C but just for fun i would like to see a game project ;)
    thx again !!

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,083
    Rep Power
    4

    Default Re: using images on java

    Quote Originally Posted by ShadowWalker View Post
    yeah i know that java is actually slower that C++ or C but just for fun i would like to see a game project ;)
    Not necessarily true, given the right circumstances a Java application can actually perform better without personal optimization efforts because of the rather excellent optimizer built into Hotspot.

    What makes Java less useful for game programming is in the fact that the deployment is quite hard; you need a Java runtime already properly installed before the game can even work - and it needs to be the right version too. That is expecting a lot of your target audience. A popular way to deal with that is to actually bundle a Java runtime with your game, which makes it easy for the gamer and hard for you because there is of course not one runtime to rule them all but there are multiple, targeting different platforms (32/64 bits, for windows, linux, mac, solaris, ...)

    LibGDX is cool in that it actually extends beyond regular Java and also allows you to deploy your game to Android, iOS and "html 5".
    ShadowWalker likes this.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 0
    Last Post: 11-14-2012, 11:15 AM
  2. Java Images via JAR
    By JayF in forum New To Java
    Replies: 22
    Last Post: 04-05-2012, 11:31 PM
  3. Replies: 0
    Last Post: 12-16-2010, 05:14 PM
  4. Replies: 4
    Last Post: 12-16-2010, 04:32 PM
  5. Replies: 7
    Last Post: 07-22-2008, 05:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •