Interpolate issue

motorcycle boymotorcycle boy Member Posts: 429
edited February 2015 in Working with GS (Mac)

Ok yet another issue I'm trying to figure out a solution for. I have an obstacle that when overlapped with my character, will cause my character to get very heavy and he will start to fall down the screen. For this I use an interpolate behavior. I also use a game level attribute "game.state" for my main character. So if game.state = 3 then I have the interpolate coding fire and he starts to descend slowly. However when I use a power up he stops being so heavy and the player can now tap him and he will fly as normal. My problem is how to get the interpolate behavior to stop it's interpolation. When I use the power up I have the game.state change to 2 which enables the tapping to resume by the player. But the interpolate is still going through with what I told it which in this case is if game.state = 3 interpolate character to -50 Y with a 5 second interpolation. So when game.state changes t o2 it is still carrying out this command and overrides the ability to tap the character to make him fly. Hope that makes sense.

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    It's 'difficult' to stop an interpolate prior to its completion. Search on the forums - I believe there are a few demo files which show you how to cancel interpolates.

  • motorcycle boymotorcycle boy Member Posts: 429

    @Braydon_SFX ah I see I had no idea. In that case I will just use a different behavior if I can. I won't use interpolate if I don't have to.

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    @dreichelt said:
    Braydon_SFX ah I see I had no idea. In that case I will just use a different behavior if I can. I won't use interpolate if I don't have to.

    Interpolate is my favorite behavior. I use it all of the time. You just have to know when not to use it. :)

  • motorcycle boymotorcycle boy Member Posts: 429

    @Braydon_SFX said:
    Interpolate is my favorite behavior. I use it all of the time. You just have to know when not to use it. :)

    Yeah I like it as well. Guess I still have to find out when not to use it haha

  • motorcycle boymotorcycle boy Member Posts: 429

    Actually I just changed the character's density which mimicked the interpolation effect and works perfectly. I just put change density and in the otherwise I had it change back to its regular density. Sweet workaround.

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    Hey @dreichelt,

    In a few of my projects I have interpolate running and there is a way to "cancel it" if you will.

    • Create a real or integer attribute and lets call it something like "interpolate_time"
    • So in the interpolate rule for duration you put the "interpolate_time" attribute there
    • Then you can have; when something occurs such as a touch, collide, position reached, etc, change the "interpolate_time" attribute to 0 which will stop it.

    Posting an example for you. In the example the actors interpolate position is set to 400 and its duration is set to 400. Once its position x reaches 200 it changes the interpolate set position from 400 to 200 and its duration to 0 which stops it.

    Hope this helps!

  • KillerPenguinStudiosKillerPenguinStudios Member Posts: 1,291

    My above comment might be of some use to you @Braydon_SFX as well and others here on the forums! :D

  • motorcycle boymotorcycle boy Member Posts: 429

    @KillerPenguinStudios wow thanks man I will have a look at that!

Sign In or Register to comment.