How do I avoid sprites to be overlapped

Get help using Construct 2

Post » Fri Jul 29, 2016 4:30 pm

@99Instances2Go
@ROJOhound

Hello guys!

Its a few steps, until i can finish my project. And today ive got a question about avoiding overlapping sprites. Of course there is a event "on overlapping with object X". But let me explain the situation.

ive three doors on which i spawn (create) sprites. In round 3 i spawn 3 sprites on each door in a random area ive created (this works perfectly). But now it can happen, that this sprites will overlap themselve, which is very bad, because you have to recognize the symbols of each sprite.

ive tried a lot to solve this problem, but it doesnt work. Below this post, you can see an image of my events, and how i did it. My event checks in second instance if the sprite is overlapping with another sprite (the sprites are from the same sprite object - with differend animationframes)

But i dont know why this second event instance is never called (see the picture). Does construct dont recognize overlapping events if its the same object?

Image:
postimg.org/image/hxu26j1dz/


Much of thanks to all!

Best regards!
Last edited by Congrats2u on Tue Aug 02, 2016 9:25 am, edited 2 times in total.
B
8
S
2
Posts: 141
Reputation: 1,002

Post » Sat Jul 30, 2016 2:48 am

Sorry, I had a quick look at the image but wasn't able to fully understand it because I was in a hurry, buuut... A quick and dirty workaround is to reposition the sprite if it's overlapping another one. Something like,

If Sprite overlaps Sprite + Pick 2nd instance of Sprite --> Set position to random

This way it'll keep moving the sprite if it's overlapping another, so eventually it'll end up with them not overlapping.
B
50
S
23
G
17
Posts: 291
Reputation: 12,432

Post » Tue Aug 02, 2016 11:47 am

@ Sup with that?

I solved it a little bit differend... On the spawning part - i splitted the spawning area via code into 3 differend areas to determine overlapping issues - this works perfect. Another solution with the "on overlapping" event still doesnt work.

Thank you very much Sup with that for your idea!

Best regards
B
8
S
2
Posts: 141
Reputation: 1,002


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests