Results 1 to 6 of 6
  1. #1
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default Java Different Layers, Need Help For My Game Loaie.

    My game is basicly just a giant grid. Wich reminds you of Dwarf Fortress adventure mode. The game will soon go into the Alpha 1.0 & be released. So I need some help to give the characters & mobs in the game a nice transparent background.

    So as I said before. The game is basicly just a giant grid. On this grid you can walk around with your character. But in order to see what's behind the character & add mobs (Monsters & Animals) I will need to add a layer over this one.

    The game is created with JPanels. Each one of those JPanels is holding a JLabel wich is holding an image.

    What I want is another layer, over the first one. Wich is containing exactly the same things as the first layer, except of that the images will have a transparent background.

    For an example of how I mean, visit Legends of Yore, and see how the bag works. It's basicly over the grid. Thanks!

    Best Regards Alerhau

    P.S. The help you guys have been giving me so far on all of my projects is awsome!

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    7

    Default

    I don't know anything about those games, but if you want multiple layers then you can use a JLayeredPane.

    See: How to Use Layered Panes (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

  3. #3
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default

    Any more help?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Alerhau View Post
    Any more help?
    What more help are you expecting when you don't say what is wrong with the help already given. It is sound advice and I heartily second it. If you have problems implementing it, then you will want to provide the details of the problems.
    Last edited by Fubarable; 08-07-2011 at 06:41 PM.

  5. #5
    Alerhau's Avatar
    Alerhau is offline Senior Member
    Join Date
    Jun 2011
    Location
    Sweden
    Posts
    158
    Rep Power
    4

    Default

    I need a five row example. (That's all.) Sience I am not very good at understanding that kind of tutorial.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Alerhau View Post
    I need a five row example. (That's all.) Sience I am not very good at understanding that kind of tutorial.
    Sorry if this sounds harsh, but you will get better at understanding the tutorial and coding in general with practice and effort. You've nothing to lose to study it again and to try to apply it to your program; believe me it is effort well spent. If you then don't succeed, you'll at least be able to ask a specific answerable question, so it would help us help you too. Also, I've done something similar but with a chess program, and if you search the forum, you'll find this code in one of my answers.

    Best of luck.

Similar Threads

  1. Replies: 1
    Last Post: 08-02-2011, 01:34 PM
  2. Replies: 12
    Last Post: 06-07-2011, 10:56 PM
  3. Layers or composite?
    By trishtren in forum Java 2D
    Replies: 1
    Last Post: 04-07-2011, 08:08 PM
  4. Mouse listening across layers
    By dvreed77 in forum AWT / Swing
    Replies: 1
    Last Post: 02-17-2011, 03:42 PM
  5. questions about events in differents layers
    By Jon_Xel in forum AWT / Swing
    Replies: 10
    Last Post: 07-13-2010, 05:37 AM

Tags for this Thread

Posting Permissions

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