Overlapping problems

0 favourites
  • 9 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi every all!

    I don't know if i lose my mind or not...

    Regarding this simple code with 3 overlapping conditions, why at the end of all the text is not set ?

    i need to check the 3 sprites (that in my case i used like a cam and in reality are10 sprites) that overlap a map and checking what they are overlapping in order to simulate a dungeon crawler like Dungeon Master)

    The yellow square is moving over the map and it got 10 image points in order to set the cam sprites (blue circles) to follow the yellow square at the same time.

    link demo:

    https://leucocytic-binder.000webhostapp.com/DUNGEON%20V2/index.html

    thank you in advanced!

    Andy

  • Could you share the CAPX? It's hard to see from the image or your demo where all the sprites are.

  • Hey it's hard to tell from the info you provided, but I'd do two things:

    1) check the map_wall object, there may be a reason why there is no collision detected

    2) Instead of nesting the code up to 3 levels (or 10 levels), add an "AND" condition so they all can be checked in the same block

  • Thank to all!

    Makotto: i checked all the map_wall sprites and seems they are all ok (i changed the sprites size, i put all the sprite in the same layer too) . Regarding the code i did also the "and" condition setting the overlapping check in the same condition and seems that if i have 3 or more conditions of overlapping the code won't work, with just 2 condition of overlapping it work correctly. (but i need mor than 3....)

    Dop2000: the link of the demo is in the first post. Regarding the capx i will share it soon because i'm not in home!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey argail!

    You should definitely use an array to store the map and check array neighbours to build your "camera view" instead of checking for overlaping...

    Here's an example of array use for that.

    Didn't implement all controls. Just click to advance. Also, I couldn't get the exact rules you're using for building the camera preview, but I guess you can easily adjust it.

    https://www.dropbox.com/s/hjvvd742zfo4v ... .capx?dl=0

    Cheers!

  • I know what's wrong with your code.

    When you check first if cam_lontana_sw is overlapping map_wall, you pick 1 instance of map_wall.

    Then, when you are trying to check if cam_lontana_centro is overlapping map_wall, you are not testing all map_walls, but only that 1 picked instance.

    If you modify the code like this it works:

    Or you can wrap all checks in functions and use them like this:

    And I have to agree with brunopalermo, the method you are using is not very efficient.

  • Thank you all!!

    Bruno Palermo: sei per caso italiano? Io pure!

    In the past I used the array but I felt that the code was very slow... I will study your example, probably my my past arrays code was really bad !

    Dop2000: thank you in advance, I will test your information, I hope it work because in this way I can create the map and in the same time the mini-map !

  • I'm sorry Brunopalermo, I saw in your account that you are Brazilian!

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