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 5 of 5

Thread: Tiled map

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Tiled map

    Hi I am programming a tiled map with three layers, where I want to draw Tiles by Zorder, smallest - largest, I have got it to work for the top of the map, however the further you go down the other tiles end up always drawing over the character I have on screen:
    map.jpg

    Any ideas of what I should be defining my ZOrder value at, currently they are:

    m_nZOrder = this.m_nLayer *(m_Image.getLocation().y + m_Image.getHeight());

    I have also tried just doing it by using this as well:

    m_nZOrder = m_Image.getLocation().y;

    which gets problems like this
    map1.jpg
    Attached Images Attached Images


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Tiled map

    You're going to have to play with a couple different things. You haven't posted an MCVE, so it's really hard to debug this for you. What if you use the bottom of the sprite (y+height) as the z order?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Tiled map

    i already tried using the bottom of the sprite (y + height), it doesn't work. thanks for the suggestion:-)

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Tiled map

    What exactly do you mean when you say "it doesn't work"? It's pretty impossible to help you with the information you've provided.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Tiled map

    The character draws over the tiles, sorry I should have said that instead.

Similar Threads

  1. Isometric (non tiled) background
    By Vinvar in forum Java Rendering and Gaming
    Replies: 4
    Last Post: June 9th, 2017, 09:19 PM
  2. Isometric (non tiled) background
    By Vinvar in forum Java Theory & Questions
    Replies: 0
    Last Post: September 8th, 2014, 04:49 AM
  3. Replies: 9
    Last Post: September 1st, 2012, 07:25 AM
  4. Map implementation.
    By javapenguin in forum Collections and Generics
    Replies: 12
    Last Post: June 4th, 2012, 01:08 PM
  5. World Map
    By LorenzoR in forum AWT / Java Swing
    Replies: 5
    Last Post: December 2nd, 2011, 11:20 PM