Understanding Object Overlap

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • What I understand about MMF2 is that it's impossible for objects in different layers to collide or interact with one another; what happens if a large mother object has multiple child objects, and perhaps I want to have the player object overlap behind or in front an extensive library of certain categorized objects (Which could've been easy if the layers have the option to interact). Is there a simpler alternative method of arranging objects cleanly without the constant use of "send to back", "send to front", "send backwards", or "send forwards"?

  • An Overlap Condition triggers regardless of which Object is visually in front or back of eachother ( they need to be on the same layer though ).

    You can easily have Overlaps across all of your Layers, its just a little messy.

    METHOD A
    Say your Player exist in Layer 1.
    And you want the Player to be able to interact with Objects in Layer 2.
    You can have an invissible Player Dummy Object ( like a collision mask ) existing in Layer 2, which allways follows the Players possition.
    This way you can easily determine if Player in Layer 1 is Overlapping something in Layer 2, without messing with Players Order or Layer in any way.

    METHOD B
    You can have the Player interact with any number of Layers, by moving Player thorugh all the Layers and check for Collisions inbetween the moves, and of cource move him back to his original Layer in the end, like this:

    ( Player starts at Layer 1 )
    - Check for Collision
    - Move Player to Layer 2
    - Check for Collision
    - Move Player to Layer 3
    - Check for Collision
    - Move Player to Layer 1

    This method will probably mess up the Players Order when he returnes to Layer 1.
    You could maybe overcome this by storing the Players Order ( Z position? ) before you move it between Layers, and apply the Z position once it returns again, dont know how this will work out though ( i think you need the Layer Object for this ).

    METHOD C
    This method does not require any extra Objects and does not require you to move Objects between Layers to check for Overlaps.
    This methos can check for Overlap across all or any Layers without much hazzle, but all Overlap areas ( or collision masks if you prefer ) have to be rectangular.

    To do this method you manually check for Overlaps by compairing to the overlaping Objects X Y coordiantes, hench the rectangular Overlap areas.
    When you compair Object X Y coordiantes this way, which Layers the Objects reside in is irrelevant.
    Your mind might melt trying to do this method, but it shouldnt be that hard.
    ...
    Dono if this is of any help.
    If not maybe you could explain again?

    How can i change username and display name?
    Please login to see this link.

    Edited 2 times, last by King_Cool (April 18, 2013 at 12:51 AM).

  • Is there a simpler alternative method of arranging objects cleanly without the constant use of "send to back", "send to front", "send backwards", or "send forwards"?


    Yes. Use the Layer Object.

    Always -> Sort by Y position decreasing

    This will cause any object with a lower Y value to draw behind any object with a higher Y value. This is usually the solution to the majority of people's layering issues. For more advanced situations, you would sort by an alterable value decreasing, and the alterable value would be the object's y position plus some other manually defined value to force certain objects to draw at a specific level.

    Also want to throw out there.... you don't have to use an Always event if the objects aren't going to be moving around one another. You can just sort once and be done with it. For instance, if you just have some level and you want to make sure all the objects properly draw to the right order straight away, you can change it to Start of Frame and then do the y decreasing sort once.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • Yes. Use the Layer Object.

    Always -> Sort by Y position decreasing

    This will cause any object with a lower Y value to draw behind any object with a higher Y value. This is usually the solution to the majority of people's layering issues. For more advanced situations, you would sort by an alterable value decreasing, and the alterable value would be the object's y position plus some other manually defined value to force certain objects to draw at a specific level.

    Thank you for replying, but exactly what do you mean by "Y value"?

    A. The vertical position of an object (whether it's above or below another object)
    B. An option in the "layer object" that manages the Z value of each active object (saying I can write a custom value number for each object that indicates how the objects are behind or in front one another)

    P.S- Can the layer object manage the arrangement of groups of objects?

    King_Cool- I understand that objects will always interact with one another if they're in the same layer. The reason this concerns me is because, I want objects to overlap properly; like having all items always appear inside containers (say, transparent glass container with opaque light streaks and all) rather than having an odd couple of items appear in front of the containers.

  • Thank you for replying, but exactly what do you mean by "Y value"?

    A. The vertical position of an object (whether it's above or below another object)
    B. An option in the "layer object" that manages the Z value of each active object (saying I can write a custom value number for each object that indicates how the objects are behind or in front one another)

    P.S- Can the layer object manage the arrangement of groups of objects?

    King_Cool- I understand that objects will always interact with one another if they're in the same layer. The reason this concerns me is because, I want objects to overlap properly; like having all items always appear inside containers (say, transparent glass container with opaque light streaks and all) rather than having an odd couple of items appear in front of the containers.

    But... Thats your job man, you have to programm the Items to order behind the Containers, or the Container to be infront of the Items...

    Are you saying you dont know how to do this?
    That you find it problematic how its done?
    Or are you looking for the 'best' way of doing it?

    How can i change username and display name?
    Please login to see this link.

  • To be honest, I'm looking for the most efficient way of doing it.
    Even as a really novice programmer, I know how to arrange objects properly but individually, as well as executing simple customized code.
    I know programming's the toughest and longest part about making even the simplest game; I just want to make the game with as little mundanity and unnecessary time consumption as possible.

    "...having all items always appear inside containers..." What I mean by that is "without even looking at the "send to back", "send to front" options, I can simply have an item object or an entire group of item objects remain behind the container objects, no matter how much I copy, clone or manipulate.”
    To my understanding of the layer object both you and Konidias is referring to, if the "Y value" of the layer is identified as B (And by looking back at your suggestion in Method B, it's probably true), that itself just made my programming job a tad less tedious.

  • I think what will benefit you ( if you dont allready know ) are Qualifyers.
    You can apply Actions to groups of Objects, by giving the Objects the same Qualifyer and referring to the Qualifyer in the Event Editor.
    You assign a Qualifier to an Object thought its Property Window.

    Think of it as a bunch of Objects belonging to the same group, for convenient and easy referrance.
    Hope this helps.

    How can i change username and display name?
    Please login to see this link.

  • Thank you for replying, but exactly what do you mean by "Y value"?

    A. The vertical position of an object (whether it's above or below another object)
    B. An option in the "layer object" that manages the Z value of each active object (saying I can write a custom value number for each object that indicates how the objects are behind or in front one another)

    P.S- Can the layer object manage the arrangement of groups of objects?


    By Y value I mean the Y position of each object. The vertical position.

    But as I mentioned, you can also sort by any value you choose. In my above post I mentioned if you want more control over specific objects, you would set an alterable value to their Y position and then some other value that will force that object to be treated like it's at a different Y position. For example, if an object is at Y position of 200 and you set the alterable value to Y position + 100, then the value will be 300, and the object will get sorted as if it's at Y position 300 (meaning it will draw over an object that is at y position 250 even though the original object is really at Y position 200... since the layer object *thinks* it is at 300 and not 200)

    As King_Cool mentioned, you can use qualifiers to group objects together, and then apply my technique to force them to always draw on the same "level" together. However I still don't think you're going to get exactly what you're wanting. If you posted an example of what you need, we could probably get it to work for you.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • I made an example... when you load up the example, it will actually be "broken". Read the comments to see how to fix it. :) Then it will make a bit more sense what is happening.

    Please login to see this attachment.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • Man, it would've been awesome if the answer was B!

    Thank you both so much for your help!

    I will use the layer object and find a way to work around it, so every object has their own place in the game.

    P.S- The constant mention of "groups", I did mean qualifiers; I knew the term and its use, but I just forgot the name.

  • Technically the answer *is* B. My example shows use of it... By sorting by an Alterable Value, you can actually set each object's value to whatever you want and it will sort in order.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • Update-
    Finally, I've seen your file Konidia's, and now I understand everything you were trying to explain to me!
    I was confused why the Y value was so necessary when we were talking about layers in a game; now, I see that you were seeing it from an RPG perspective!
    I was seeing layers from a platforming perspective, so I was concerned on what were you trying to say...
    Once again, thanks for all your help!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!