GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to Stop Interpolate half way through action?

ozboybrianozboybrian PRO Posts: 2,102
edited December 2011 in Working with GS (Mac)
Ok forum search sucks now. Tags are pointless, doesn't come up with the right thing.

And google links tend to do this:
"Not Found

The requested URL /forums/topic.php was not found on this server."

So I did try find the answer :/

So I interpolate my Jet... And when it gets shot it resets position but keeps interpolating! lol...
Help please? : )

Comments

  • beefy_clyrobeefy_clyro Member Posts: 5,390
    edited December 2011
    As far as I'm aware, interpolates will occur until they reach their destination.
    The only way i think you can break is wrapping it in a timer in a rule.

    If Jet.Hit = 0
    Every 0.5 seconds interpolate .......

    Otherwise
    If Jet.Hit =1
    Interpolate .....

    And yes searching sucks big time now!

    Also not sure why this is in codemonkeys corner???
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    I used timers to Mimic interpolating alpha and be able to break it without error

    If attribute1 = true
    And self.alpha>0

    Every 0.05 seconds change self alpha to self alpha - 0.05

    Otherwise

    If self alpha < 1

    Every 0.05 seconds change self alpha to self alpha + 0.05
  • calvin9403calvin9403 Member Posts: 3,190
    Use another interpolate to the actor

    Ok, and please just copy
    The discussion number over here and it works great

    Calvin
  • applaudmobileapplaudmobile Member Posts: 208
    The failsafe method I use involves constrain and a few self attributes. Because you might want to stop an interpolate that take 5 seconds and change to an interpolate that takes 1 second. It will jump back to the original interpolate or do some weird stuff.

    So what I do is this :

    constrain game.myatt to self.inter1
    interpolate self.inter1 to 100 over 5 seconds

    if new rule applies
    constrain game.myatt to self.inter2
    interpolate self.inter2 to -100 over 1 second

    it completely disconnects from the original interpolate!






  • ozboybrianozboybrian PRO Posts: 2,102
    Lovely suggestions guys... Let's pretend they all work.

    What would be the most efficient less demanding one on the system?
    Thanks heaps!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Check out my demo page. I have a cancel interpolate demo I did a while back. It's along the lines of what applaud mobile posted

    It's not my fault I never learned to take responsibility for anything. ;)

  • ozboybrianozboybrian PRO Posts: 2,102
    Sure, do you have a link? haha.
  • ozboybrianozboybrian PRO Posts: 2,102
    Any Pros wanna come on Skype and help a guy who's been with GS (with and without mac) for over a year?
    Still haven't released a game lol...
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    click my user name. or just open gamesalad and search cancel interpolate under new and you can download it.

    It's not my fault I never learned to take responsibility for anything. ;)

  • ozboybrianozboybrian PRO Posts: 2,102
    Oddly.. I can't run or download the file... I did the GS pluggin thing but nothing happening :S
  • beefy_clyrobeefy_clyro Member Posts: 5,390
    Do it in game salad program itself and allow enough time for it to search through
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    edited December 2011
    image
    Did you wait for the progress bar to run through? showed up fine for me. it did take a few minutes of loading though

    It's not my fault I never learned to take responsibility for anything. ;)

  • ozboybrianozboybrian PRO Posts: 2,102
    Thanks Tenrdrmer!

    I never remember to look via the actual GS app.
    Question: How would I suit this to interpolate movement? ... Might sound dumb but I tried a few ways and no dice.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    same way. You just use the position attributes. Actually search for scene preview I have one that uses interpolate to move the camera around and then there is a cancel button that will cancel the preview before its done.

    It's not my fault I never learned to take responsibility for anything. ;)

  • FabledAppsFabledApps Member Posts: 17
    edited December 2011
    Can an admin delete my comment. Incorrect post.
  • ozboybrianozboybrian PRO Posts: 2,102
    Maybe I should stick with the move behaviour :/
  • ozboybrianozboybrian PRO Posts: 2,102
    I'm trying @mu-KowAps method.
    I'm to blonde for the other ones... Driving me nuts. And now the GS App search function appears to be dead :/

    Would you say his method is efficient?
  • ozboybrianozboybrian PRO Posts: 2,102
    edited December 2011
    WOO! I created a successful working random timer.

    For the one actor though, he has 3 constantly working attributes.
    Boolean for the when to attack.
    Interger for the random timer.
    Index for the hit counter.

    Is that good or too demanding?
  • beefy_clyrobeefy_clyro Member Posts: 5,390
    Anything on its own is fine, its when its coupled with everything else. Its impossible for us to know if its good or too demanding as each project is different, just do a device preview and look at those numbers and see for yourself.

    Things that hurt performance are generally;

    Constrains
    Timers
    Spawns

    Its like junk food though, too much is bad but like anything in moderation, its fine.
  • ozboybrianozboybrian PRO Posts: 2,102
    Thanks Beefy, good example.

    Using loads of timers but that's kinda it... Can't access the Preview for my device at the moment (long story) but will as soon as she's up and running again! Thanks ya'll.
  • gambetgambet Member Posts: 38
    Hello,

    I cannot find "Cancel Interpolate" via GS app. Is there any download link or am I doing something wrong?

    image
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Its my Demo.

    Let me see if I can dig up the original

    It's not my fault I never learned to take responsibility for anything. ;)

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    @bvukman here is a link to download the cancel interpolate demo as well as a scene preview demo I made that shows the cancel working in a practical situation.

    http://www.mediafire.com/?1sdrvi42lzx99p6

    It's not my fault I never learned to take responsibility for anything. ;)

  • CloudsClouds Member Posts: 1,599
    How to Stop Interpolate half way through action?

    Here's a very simple way.

    Just destroy the actor with the interpolate movement and spawn an identical actor but without the interpolate behaviour.

    Example (click on the moving actor):
    http://www.mediafire.com/?ey9174ll5wipn28

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Tynan you realize constantly spawning and destroying actors can have a serious effect on your apps performance right?

    It's not my fault I never learned to take responsibility for anything. ;)

  • CloudsClouds Member Posts: 1,599
    edited March 2012
    Tynan you realize constantly spawning and destroying actors can have a serious effect on your apps performance right?
    Absolutely I do ! Nowhere in my post do I recommend 'constantly spawning and destroying actors'.

    I thought it might be a useful and simple little trick for certain situations, but it might not be useful for everyone of course.
  • gambetgambet Member Posts: 38
    Ok, this is what i did:
    I have an actor that throws fruits. It interpolates for 0.75 seconds 20 pixels down, and then interpolates up 20pixels for 0.75 seconds. This is in a rule which is triggered by a REAL attribute (0- false, 1- true).
    In interpolate behavior for time I've inserted "0.75*myreal-attribute".
    So when myreal-attribute is 0; rule with interpolate is not valid anymore, and interpolate behavior ends.
    This is only how to end interpolation, but now there is no problem to override it.
This discussion has been closed.