expression for: the further actor 1 is, the more opacity actor 2 has (actor 1's shadow)

3xL3xL Member Posts: 676
edited August 2012 in Working with GS (Mac)
ive been messing with this and cant get it right. basically i have an actor. he has a shadow under him. ok?

when he jumps, the shadow gets less visible (gradually, not instantly) and as he comes back to the ground, the shadows gradually appears back.

i did a WORKAROUND on this with Elastik (for those of you who had played it, take a look at it...), but i think it would be better if it used some kind of formula using magnitude perhaps? any ideas? i'm sure theres away :p

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @mynameisace helped me out with this a while ago. He suggested using a percentage and the formula I ended up with was Constrain self.color.alpha to floor( game.RisingActorY-1000)/(0-1000)-.3. I did something similar with the width of the shadow by constraining self.size.Width to floor( game.RisingActorY-1000)/(0-1000)* game.RisingActorWidth.

    The 1000 values are the max possible height of the RisingActor in my game. The subtraction of .3 was just because I wanted the alpha value to go from .7 to 0 instead of from 1 to 0.

    Hope that's helpful!

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

  • 3xL3xL Member Posts: 676
    thanks. lemme give that a shot.... i'll brb with the results :)
  • 3xL3xL Member Posts: 676
    holy baby jesus's mother of abraham lincoln! thanks!i can now change the formula i have on elastik to this one as well as my current WIP :)
Sign In or Register to comment.