constrain ALPHA to MAGNITUDE???

3xL3xL Member Posts: 676
edited May 2012 in Working with GS (Mac)
i can assume this is possible :p

basically heres my thing:

i want actor1 to be invisible. but the closer it gets to actor 2., the more visible it gets. then if it goes far from actor 2, it goes invisible again. i want it to behave NATURALLY, not as a trigger (or interpolate). i have a work around but it looks more like an alpha interpolation rather than the visibility appearing depending how close i am to actor 2. it hard to explain as text. lol am i making any sense?

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2012
    Sure, you can do it. alpha is just a value from 0 to 1. So if you make sure your magnitude formula always returns a value from 0 to 1, you're set.

    As an example, if you know that the maximum distance between your actors will be 600 and the minimum will be 0, you could do Constrain Attribute self.color.alpha to (600-magnitude(self.position.x-game.OtherActorX, self.position.y-game.OtherActorY))/600.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.