A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [help] depthsorting

  1. #1
    self-portrait Kianis's Avatar
    Join Date
    Feb 2004
    Location
    Stockholm, Sweden
    Posts
    425

    [help] depthsorting

    I've got a quite embarrassing problem. I don't know how to properly sort my objects for this tilebased game I got. I'm using the formula
    depth = y *maxX +x
    but that's just temporary as I want to be able to place more then one object at the same tile. Actually it's not hard to figure out how to fix it - the real problem lies in the fact that flash swaps depths if the depth specified is already in use. Therefore it works sometimes depending on which depth the other mc got.

    I made this example, and I'm attaching the .fla aswell.
    // Mazapán, my portfolio

  2. #2
    self-portrait Kianis's Avatar
    Join Date
    Feb 2004
    Location
    Stockholm, Sweden
    Posts
    425
    It's a classic - I forgot to attach the file
    Attached Files Attached Files
    // Mazapán, my portfolio

  3. #3
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    give each mc a unique number (num). count all the mcs (tot)
    (y * maxX) + (x * tot) + num
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  4. #4
    self-portrait Kianis's Avatar
    Join Date
    Feb 2004
    Location
    Stockholm, Sweden
    Posts
    425
    Thanks, but it still won't work perfectly :/
    When two objects are on the same tile the one with the highes unique number will always be on top.

    updated swf

    Edit: Sorry, sorry - I got it to work. I wish there was a more efficient way then reassigning their depth every frame though. Thanks blinkOk.
    Last edited by Kianis; 03-31-2005 at 10:32 AM.
    // Mazapán, my portfolio

  5. #5
    President PhobiK's Avatar
    Join Date
    Jan 2005
    Location
    Guatemala
    Posts
    918
    Hey kianis, i remember your game of the last 48 hr comp, it was amazing, the idea was very original and the collision detecting was nice. I haven't seen you in the actual 48 hr comp forum, are you going to participate?
    This is MC. His _parents sent him to stop() by the super market to buy some _root beer if he wanted to gotoAndPlay() with his friends at the park later.

    This is my Blog!... The gaming Process
    Please check out my site: Giddel Creations

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center