Overlapping problems

Get help using Construct 2

Post » Fri Sep 08, 2017 10:01 am

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 ?

Image

Image

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
B
9
S
2
Posts: 117
Reputation: 1,009

Post » Fri Sep 08, 2017 12:23 pm

Could you share the CAPX? It's hard to see from the image or your demo where all the sprites are.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 849
Reputation: 28,507

Post » Fri Sep 08, 2017 1:21 pm

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
B
28
S
10
G
10
Posts: 97
Reputation: 6,584

Post » Fri Sep 08, 2017 7:11 pm

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!
B
9
S
2
Posts: 117
Reputation: 1,009

Post » Fri Sep 08, 2017 9:00 pm

B
9
S
2
Posts: 117
Reputation: 1,009

Post » Fri Sep 08, 2017 9:27 pm

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!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
20
S
6
G
3
Posts: 637
Reputation: 3,776

Post » Sat Sep 09, 2017 3:23 am

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:
Image

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

And I have to agree with @brunopalermo, the method you are using is not very efficient.
Check out my awesome game Doptrix
B
17
S
9
G
51
Posts: 849
Reputation: 28,507

Post » Sat Sep 09, 2017 9:15 am

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 !
B
9
S
2
Posts: 117
Reputation: 1,009

Post » Sat Sep 09, 2017 9:17 am

I'm sorry Brunopalermo, I saw in your account that you are Brazilian! ;)
B
9
S
2
Posts: 117
Reputation: 1,009


Return to How do I....?

Who is online

Users browsing this forum: tannerdler and 24 guests