Drag and drop game / actor behind another one

raciukas22raciukas22 Member, PRO Posts: 47

Hello, I was creating a drag and drop game. The problem is that once I drag an image it goes behind other images. I was wondering would anyone know how could this be fixed? Thank you very much.

Comments

  • MasterCosmoMasterCosmo MichiganMember Posts: 13

    You might have to right click the actors you are dragging around and move them to the front. If you have many images that you need to be on the top every time the user drags it, I would recommend that on click/touch, delete the actor, then spawn an identical one in the same place, giving it the highest presence.

    I'm new at this so I'm not sure this is the best solution, but it's what I've used when playing around.

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited June 2014

    It's actually fairly tricky, as we can't move actors between layers once the game is running.

    So first make sure the actors are in a layer order that works for you. (you can look at the layer order of your actors in the Scene, layer tab).

    If you do need to change the order of actors mid game:

    You could try MasterCosmos idea with the deleting of an actor and having it spawned. If you always spawn from the same actor and have it spawn behind it would mean the latest actor is always at the top...

    Alternatively, you might have the same actor spread over 2 or more layers, and have the appropriate one activated, so it can appear in front or behind other actors depending on the actor you have activated. By 'activated' I mean you'd trigger a self.attribute from 0 to 1.

    Edit: Not so bad... it broke once or twice... but as long as I save where it go up to, it and carry on from the last saved co-ordinates it just appends the paths to the list so far on the server... (saving a CSV file everyone and then just incase it goes wrong).

  • imjustmikeimjustmike Member Posts: 450

    Well, it depends on if you want the selected actor to always be on top, or only when it's 'selected'. If it's the latter, you can follow this tutorial:

    If it's the former, then, the only way I can think of is similar to what @StormyStudio‌ is suggesting - have actors with rules triggering their opacity. If you don't have too many actors you can have 'duplicate' on each layer that's hidden until activated. Though it would quickly become unmanageable if you have more than a handful of actors.

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited June 2014

    Sent you a pm as we have a free one on DBA but can't post the link due to forum rules :( just search "layers" in our search box over at deepblueapps and you will find it.

    Darren.

Sign In or Register to comment.