[SOLVED] How do I use overlaping at offset correctly - 2 conditions never true?

0 favourites
  • 6 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • So what i am trying to do is pretty straight forward, and maybe i am missing something or its an engine quirk i dont know about but it just seems not to work.

    I have a 128x128 grid, where i want to place "rails" which should connect themselfes automatically. Therefore i check the neighboring sprites with "overlapping at offset".

    so this works: gyazo.com/9c16badd3235b5c920df8eef08e0c972

    as you can see here: gyazo.com/5a13a9055ce0032ff21e3c4eca6ab46f

    it switches the frame regardless if the other rail is right or right and above it. which is fine.

    however when i do it like this: gyazo.com/a5a77cc73eebe869efd440c6b9aa2238

    It does not work: gyazo.com/a7a8bec39d0925aa79e175bedb45a906

    can someone tell me how it can be that both conditions are never true when each single one is true? I really dont get it, what am i missing?

    Thanks & Kind regards

    Joschi

  • The first one is an 'or' the second one is an 'and'. Make it an 'or' and it will work.

  • Hey Asmodean,

    but both condition should be true! So if i test every single condition it works in both cases. But i want them both to be true at the same time! It was just for demonstrating that both work (OR) but AND does not work even when both are true...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sorry my fault, answering before understanding the question completely.

    I think that is more a picking problem. In the second version the overlap (128,0) is already in (128,-128) covered. So it picked only the (128,-128), I guess. I also think that the for each is a problem. In this sub event it has only one choice, because the for each picked one raildetector.

    If you have an and event with two conditions it can only be one picked. If you want that all raildetectors with overlap (128,0) and (128,-128) are picked you need and 'or' event.

    I hope that makes sense. I'm not sure myself, without an example is only guessing.

  • Hey Asmodean, no problems at all, happens to me on a regualar basis haha :D

    So your explanation actually gave me an idea how to solve this:

    gyazo.com/56f13c186732471181a0f237ed87e9d3

    This works perfectly.

    What i dont get why the my first version does not work, but maybe you are right and its a picking problem... But as i use Familys for a comparrison it seems to be an engine quirk, maybe not a bug...

    Anyways, that is solved for now with the workarround... I think making the "minecart" move along the rails will be even more complex... I tryed physics and platform behavior but both seem to be to wonky. So i have to figure out a way to determine which way to go haha :D

    Anyways, thank you very much

    Joschi

  • as it might help someone, here is my final solution which works like a charm :)

    i am pretty sure there might be a even better solution but that works for me at least :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)