Is there a way to constrain an actors distance to another one?

Well this is what i'm trying to achieve I have a main actor, a grenade & a radar. When the actor throws a grenade & if you're to close to it where the blast could kill you (120 px for example) I want the radar on top of the screen to flash like crazy warning you you're in the blast radius of the grenade. I already have the interpolating for the flashing working perfectly & already set the distance from for the grenade & the main actor. I thought it would be an extremely simple thing achieve. I looked at the template from @Braydon_sfx & that's exactly what I'm trying achieve but when I downloaded the template the flashing thing warning you you're to close to an object didn't work & I didn't make any changes to the template. So I was wondering is it possible to change position of the radar on top of the screen to the position of the grande? Or is there a simpler way to fix this? I went to bed really late trying to figure this out then I woke up really early today before school & I just finished my homework then I jumped right onto gamesalad to see if I can figure this out .

Thanks :)

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    You're using PC, correct? I used some new table expressions and functions (I think..It's been a while) which currently aren't available in the Windows Version....

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Braydon_SFX so is there another way to do this or I'm I out of luck?

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Well, the demo I made that you mentioned was a simple way to use tables to use magnitude with multiple actors, not just one with a pair of variables.

    If you have just one object, you could just use the magnitude function to determine the distance between the two objects, then create a rule to trigger something when that distance is a certain value.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @braydon_sfx I followed one of t shirts booth distance from videos. I put the distance in the bomb so that is the distance being measured. So when the main actor is really close it says 50 and when the main actor is far away the bomb says 145 and so on. So what rule should I put in the radar so when the main actor is with in 120 px of the bomb it goes off and when he gets out of 120 px it stop flashing? idk how to archive this

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    achieve this *

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    When attribute game.distance is equal or less than 50, 
    flash
    
    Otherwise: 
    Change attribute self.color.alpha to 1.
    

    Something like that...

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Braydon_SFX the problem is that the distance is a self attribute. So I tried to do something like this. Make a real attribute and I called it SafeFromBlast. So what I did was I went into the main actor and did this

    1. Change attribute self.DistanceFrom to game.SafeFromBlast
    2. Then I went into the Radar actor & said
    3. Rule: When attribute game.SafeFromBlastis < 120
    4. Do:
    5. Flash

    Because I know you can't use self attributes on other things besides the actor you made the self attribute in. So the "Change attribute" was my attempt for the radar to track the position of the Main Actor.

    Does this make sense to you?

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Okay, that's one work around - though you're going to want to alter the following:

    1. CONSTRAIN attribute game.SafeFromBlast to self.DistanceFrom
    2. Then I went into the Radar actor & said
    3. Rule: When attribute game.SafeFromBlastis < 120
    4. Do:
    5. Flash
  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    @Braydon_SFX Idk it didn't work. Do you think if I follow t shirts video again & I changed the distancrfrom to a game attribute instead of a self attribute it should work right?

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    Yes. It's hard to tell what's wrong when I cannot see your setup. Post some pics of your code - that'll help immensely.

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    NVM it worked perfect ! I just changed the self attribute to a game attribute Thanks for your help bro! @Braydon_SFX

  • http_gamesaladhttp_gamesalad Member Posts: 1,340

    btw I gave you some free awesomes on your comments cause Im nice like that lol

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @http_gamesalad said:
    btw I gave you some free awesomes on your comments cause Im nice like that lol

    You da man. ;)

Sign In or Register to comment.