Radar - Collision Overlap?

  • 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,

  • have you tried using an Else statement? Like:

    if sprite is overlapping radar --> set sprite to visible

    else --> set sprite to invisible

  • 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.

  • 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?

  • 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.

  • 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

  • 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.

    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?

  • 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

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

    Complex Problems, simple solution, thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Release 92

  • Awesome thanks!

  • you copy and paste the line right click on the pasted ones condition and invert it then set the function _set visible_ to _invisable

    _ not sure if you saw this but here a link to a tutorial I made

    making a radar

  • Think about your design. A radar shall be used to track unseen targets.

  • yes and when there of the map there unseen and you don't want to make them disappear off the radar when there on the screen

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