Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Alphabet from sprite sheet

  1. #1
    Member
    Join Date
    Jun 2010
    Posts
    48
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default Alphabet from sprite sheet

    Hello,
    I am making a game and I want to add fonts from the sprite sheet. I have 2 ways in my mind how to implement this:
    1. Cut every letter and put it into the Image Hashtable. So every time the particular letter is pressed, the letter is taken using the keycode of the letter and the image is drawn on the screen.
    2. Combine the letters into words I want to use with image editor, save it as .png and draw them at particular time and place I want (disadvantage: couldn't insert random letters)

    I don't think these ways are the proper ways to do that. Perhaps anyone could give me a better idea?
    And by the way, another way just poped up in my mind: create my own font (have no idea how to do that) and just simply call setFont method of Graphics class. Need to check about that

    P.S.
    The sprite sheet I am talking about is like this:
    Last edited by Asido; September 18th, 2010 at 11:17 AM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,237
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: Alphabet from sprite sheet

    Route 1 would give you a much more dynamic approach relative to #2. You could divide the image up in an editor (tedious), or programmatically (harder but more fun)

  3. The Following User Says Thank You to copeg For This Useful Post:

    Asido (September 18th, 2010)

  4. #3
    Member
    Join Date
    Jun 2010
    Posts
    48
    Thanks
    12
    Thanked 2 Times in 2 Posts

    Default Re: Alphabet from sprite sheet

    Oki, I am choosing the first way then

Similar Threads

  1. appending from shell script to excel sheet
    By krishnamohan in forum Java Theory & Questions
    Replies: 1
    Last Post: August 16th, 2010, 10:01 AM
  2. how to copy cells to a new sheet of excel with JexcelAPI??
    By 19world in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: June 15th, 2010, 03:49 AM
  3. Listing the alphabet in lower and uppercase
    By Nemphiz in forum Object Oriented Programming
    Replies: 2
    Last Post: May 25th, 2010, 05:25 PM
  4. Print Content on Pre Printed Sheet
    By kalees in forum Java Theory & Questions
    Replies: 0
    Last Post: February 24th, 2010, 02:26 AM
  5. Problem with sprite rotation in graphics
    By Katotetu in forum Algorithms & Recursion
    Replies: 0
    Last Post: May 8th, 2009, 07:27 PM