overlapping problem

For questions about using Classic.

Post » Tue Jul 07, 2009 2:54 am

Say I have an event like this:

SpriteA is overlapping SpriteB - then do some action

Although I want to make sure that every instance of SpriteA is overlapping a SpriteB before performing the action. Is this possible?
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Tue Jul 07, 2009 3:37 am

I suppose you could use a variable, then do:

for each spriteA
if overlapping sprite B
- add 1 to variable

if variable is equal to number of spriteAs
- perform action

There might be a better way, but that's how I do it.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Tue Jul 07, 2009 4:29 am

cheers, that should be a good simple solution.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Tue Jul 07, 2009 11:50 am

Here's one to tell your friends about:

B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Tue Jul 07, 2009 12:21 pm

crap, nice solution! Forgot about the system overlapping thing. :D
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Wed Jul 08, 2009 4:39 pm

The advanced overlap condition should work exactly the same as the ordinary sprite overlap condition if both are set to pick, so you should be able to substitute that for a normal overlap condition. (The advanced condition is intended for when you DON'T want to pick one of the objects involved)
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Jul 09, 2009 4:34 am

Will it work if I want to invert the overlapping condition, and then countmatching? To make sure that all of them are NOT overlapping? As it doesn't seem to work for me very well
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Thu Jul 09, 2009 11:05 am

Here's a picture of a problem I'm having.
(click for bigger view)


I don't want the value to be set until I'm certain that all of the trees are off the water tiles. But it still goes ahead with that event even when some of them are still on the water!!
argh, torture
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Thu Jul 09, 2009 2:32 pm

You should be able to use an else condition here.

So event 1: objects are overlapping

event 2, else

so if no objects are overlapping, the else event will run.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Jul 09, 2009 4:51 pm

What exactly are you trying to do, alspal? Is this a level builder type thing?

Perhaps if you let us in on the effect you're going for, someone could come up with a working solution.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests