Interpolate while touching

IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
edited November -1 in Working with GS (Mac)
Hello,
Could you, please help me with that?
I want to make a rule:
When player is touching the actor, then game.attribute is interpolating, but when player release his finger, then interpolation stops on the current level.

Thank you very much.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    what attribute are you trying to interpolate? Color? Position?
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    Self.color.Alpha.

    It has to be something like this:
    Player is touching the actor, and this actor is becoming visible, when player release his finger then actor is as visible at it was a second ago (if self.color.alpha was at 0.5 when player realese his finger, this attribute stays at the same level)
  • ToastKittenToastKitten Member Posts: 360
    I don't know if its possible to interupt an attribute that's already interpolating between two values, but you could try this.

    Have boolean variable like "turningVisible"

    Then set up the rules like so:

    if touch is inside
    -if turningVisible is true
    --constrain attribute: self.color.alpha to self.color.alpha+.01
    -otherwise
    --constrain attribute: self.color.alpha to self.color.alpha-.01

    if self.color.alpha = 0
    -turningVisible = true

    if self.color.alpha = 1
    - turningVisible = false

    The first rule checks always that the actor is being touched. If ever released, the alpha value of your actor will remain the same. The second rule is the makeshift interpolator if that makes sense.

    Let me know if this helps :3

    -TK
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    I found other way to do this:
    Rule:
    When touch is pressed,
    Timer: every 0.1 second
    Change attribute: self.Color.Alpha to self.Color.Alpha+0.1

    Works perfectly!

    Thank you very much for help ToastKitten, really appreciate it!
Sign In or Register to comment.