Radar - Collision Overlap?

Get help using Construct 2

Post » Thu May 31, 2012 12:18 am

Hello,

I'm trying to make a Radar solution. The basic premise is a Circle Sprite.

When an Object is Overlapping the Radar Sprite, the Object Appears. Easy! Already works.

But when the Object leaves the Radar, it should disappear. (Can't figure out)

Does anyone have any tips? I tried simply inverting the event, but it doesn't work.

Thanks,
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Post » Thu May 31, 2012 12:24 am

have you tried using an Else statement? Like:

if sprite is overlapping radar --> set sprite to visible
else --> set sprite to invisible
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu May 31, 2012 12:26 am

I just posted an example in another thread that I think is similar to what you're after.

I suspect you may need to switch your "on collision" condition for an "is overlapping another object" condition.

edit: actually, Brent's answer makes more sense.joeykid62012-05-31 00:28:56
B
12
S
5
G
5
Posts: 26
Reputation: 4,001

Post » Thu May 31, 2012 4:16 am

Well I have two instances of the same object.

When one leaves overlap of the Radar circle, it won't disappear unless the other one does too.

Any tips on how to get around this?
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Post » Thu May 31, 2012 9:49 am

Here's a quick example which I think does what you want:

http://dl.dropbox.com/u/47015043/construct2/radar-example.capx

The example changes opacity rather than visible/invisible, just so it's easier to see what's going on. I've also pinned each radar instance to a sentry object, but you could just as easily use the radar without those.
B
12
S
5
G
5
Posts: 26
Reputation: 4,001

Post » Thu May 31, 2012 11:25 am

if you have more than one sprite then you just need a For Each loop

for each sprite
if sprite is overlapping radar --> set sprite to visible
else --> set sprite to invisible

that way it'll check each individual sprite for the collision overlap, instead of checking to see if they're all overlapping at the same time

hope this helps
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu May 31, 2012 6:43 pm

[QUOTE=joeykid6] Here's a quick example which I think does what you want:

http://dl.dropbox.com/u/47015043/construct2/radar-example.capx

The example changes opacity rather than visible/invisible, just so it's easier to see what's going on. I've also pinned each radar instance to a sentry object, but you could just as easily use the radar without those.[/QUOTE]

I can't open as I have constuct version 90 and not 92. When I try to download the latest version of construct, it appears to be 90. Is this correct?
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Post » Thu May 31, 2012 6:48 pm

[QUOTE=brent_hamel] if you have more than one sprite then you just need a For Each loop

for each sprite
if sprite is overlapping radar --> set sprite to visible
else --> set sprite to invisible

that way it'll check each individual sprite for the collision overlap, instead of checking to see if they're all overlapping at the same time

hope this helps[/QUOTE]

This worked, I did a for each loop for the sprite, and not the Radar.

Complex Problems, simple solution, thanks.
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Post » Thu May 31, 2012 6:57 pm

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,786

Post » Thu May 31, 2012 8:03 pm

Awesome thanks!
Epic Space Online - Google it!
B
34
S
10
G
5
Posts: 165
Reputation: 6,637

Next

Return to How do I....?

Who is online

Users browsing this forum: anty21ro, badmoodtaylor and 11 guests