interpolate size up and back down

app-etiteapp-etite Member Posts: 139
edited November -1 in Working with GS (Mac)
hi,

I need to change the size of an actors width to a smaller size then back to its original within a small amount of time.

Ive tried this...

when attribute is true

interpolate width to 50

(then underneath)
Timer after 0.2, interpolate width to 134, run to completion

should this work because it is not :(

Comments

  • mangaroomangaroo Member Posts: 419
    add a change attribute to false as well

    when you say 'then underneath' do you mean in the otherwise box?
  • app-etiteapp-etite Member Posts: 139
    sorry no... I mean just directly underneath the last behaviour
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Instead of a timer for your back up put the interpolate into the otherwise section and make your attribute go back to false with a timer or some other event.
  • mangaroomangaroo Member Posts: 419
    ohh i see, what is the duration you have set for the first width interpolation to 50?

    if one interpolate behavior is active and another starts, the second one just cancels and will only work once the first is over.

    so if its changing width to 50 in 0.3 seconds, and you've set it to interpolate back sooner than that - problem. so try delaying the timer (after 0.2secs to a number greater then the duration for the first interp)

    if that still causes you a problem then it seems there is an issue with the attribute turning on - and make sure you turn the attribute back off
  • app-etiteapp-etite Member Posts: 139
    high tenrdrmer.

    not sure i understand what you mean.

    so..

    Interpolate to smaller width.

    otherwise

    interpolate back to normal width.

    Where shall I put the change attribute to false?

    thanks
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi app-etite, the other guys are correct, and you also have to add a timer to the change attributes (if I've understood correctly what you're after). Here's the Rules for what I think you want; you can obviously tweak them accordingly:

    Boolean att. called Pulse, or whatever

    Rule: When Att. scene.Pulse is false
    Interpolate self.Size.Width to 50 Duration: 1 second?
    Timer After 1 second
    Change attribute scene.Pulse to true

    Rule: When Att. scene.Pulse is true
    Timer: After 0.2 seconds
    Interpolate self.Size.Width to 134 Duration: 1 second?
    Timer After 1.2 second
    Change attribute scene.Pulse to false.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    app-etite said:
    high tenrdrmer.

    not sure i understand what you mean.

    so..

    Interpolate to smaller width.

    otherwise

    interpolate back to normal width.

    Where shall I put the change attribute to false?

    thanks

    Heres what I would do. Lets say the trigger to make game.attribute is a button for explanation purposes.

    So in the button

    When touch is pressed
    --Change game.attribute to true
    --Timer After 0.2 Run to Completion Checked
    ----Change attribute game.attribute to false

    Then in your actor

    When Game.attribute is true
    --Interpolate width to 50 Duration 0.5
    Otherwise
    --interpolate width to 134 duration 0.5

    As long as your second interpolate does not finish running before the first you will not having any issues. So it would be best to have it change at the same speed both directions. That way the first one is always going to be done first. Also I feel the otherwise way is better that multiple rules because it reduces the amount of processor being used to read the rules.

    ___________________________________________________________________________________
    TEMPLATES AND PROJECT HELP BY TENRDRMER. CLICK HERE!!!

    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • mangaroomangaroo Member Posts: 419
    --Timer After 0.2 Run to Completion Checked

    probably should be same as the duration?

    --Interpolate width to 50 Duration 0.5
    Otherwise
    --interpolate width to 134 duration 0.5
  • rlehmrlehm Member Posts: 320
    change self.width to (amount)

    timer .5

    change self.width to (old amount)

    The image will shrink.

    I use this all the time, when I have one image swap for on of different size, I add a size change for the new image etc.. works great
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    mangaroo said:
    --Timer After 0.2 Run to Completion Checked

    probably should be same as the duration?

    --Interpolate width to 50 Duration 0.5
    Otherwise
    --interpolate width to 134 duration 0.5

    Nope they have nothing to do with each other. He can do that if he wants for the proper effect, but it will not affect it working or not. As long as the second interpolate never finishes before the first ones duration has run out it will not mess anything up.
  • app-etiteapp-etite Member Posts: 139
    thanks for all your responses guys.

    All the advice is correct as I tested it on a clean project.. but in my game there is quite a lot going on so it is still not working correctly at the moment.

    basically, I have a jump button that when pressed, I change jump to true (with a timer of 0.5secs because I don't want the character to be able to jump again until he hits the ground)

    It is the jump attribute that I have triggering the object (which is the characters shadow) to move so I guess that is causing the problem?

    Do I just make a new attribute?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    instead of having a timer for your jump, just put in a rule when the actors colliding with the ground (so you can only jump when your on the ground)

    Have your jump set up like this:

    in the jump button youll have your rules when touch is pressed change jump attirubte to true, then in the otherwise section of that rule put a change attribute changing attirubte jump to false

    then in the player have a rule when attirubte jump = true AND when actor collides with ground
    change attribute self motion linear velocity y to 300

    use that for your jump.

    then do what Tendrmer said for your size interpolate

    When attribute jump is true

    --Interpolate attirubte self width to 50, Duration 0.5
    then in the Otherwise section of that rule

    -- put a interpolate behavior interpolating width to 134, duration 0.5
  • outasiteoutasite Member Posts: 417
    In creating my Tumor Tap I ran into some issues.

    Here is a video so you can see what I am talking about as a reference.

    Please note: I am not trying any guerilla advertising.

    I wanted to make my brain grow and shrink to have a "pulse"

    For this I did.
    >Rule: If size.width <= 161
    >>change size.width to 180
    >>change size.height to 160

    >Rule: If size.width >= 179
    >>change size.width to 160
    >>change size.height to 140

    But then I ran into a problem Interpolate stopped my actor from recognizing a collide (yes it was moveable)

    From there I had two options.
    1) constrain a invisible actor with static size 170x150 to its position
    2) interpolate two attributes WIDTH and HEIGHT, then constrain self.width to WIDTH and so on

    I hope this might become helpful. I read what you were doing and this seemed to relate.

    EDIT: I guess this might count as a warning post. If you jump, and while you are jumping you are interpolating size; anything that you want the actor to collide with will not until interpolate is
    off.
Sign In or Register to comment.