Interpolate problem

ShortAxe5ShortAxe5 Member, PRO Posts: 69

How can I use interpolate to make something go up and down repeatedly on it's own?

I've only been successful in making it go down. I need it do go down AND up and loop that behavior.

Please help me I'm stumped :(

Comments

  • ShortAxe5ShortAxe5 Member, PRO Posts: 69

    No. I'm making a flappy bird clone and I want the pipes to move up and down slowly using the interpolate behavior.

    Can you help me please?

  • diegocsdiegocs Member Posts: 531
    edited July 2014

    Maybe using a sin function rather than interpolate would be better. Learned this in calculus so maybe it can be used for something useful for once haha, so i'll give it a try and send you the function if it works

  • colandercolander Member Posts: 1,610

    There is an issue when you have two interpolate behaviours running consecutively. The second one conflicts with the first one and it wont fire. Do a search and you should find an answer or maybe someone else and post a link to it.

  • diegocsdiegocs Member Posts: 531
    edited July 2014

    I think if you try interpolating the y position to a random value and when it reaches that value just interpolate the height to another random value and so forth? like a loop thing

  • crestwoodgamescrestwoodgames Member Posts: 191
    edited July 2014

    You could have 2 rules.

    Example.

    Rule 1
    If self.position Y = 160
    Interpolate self.position Y to 20

    Rule 2
    If self.position Y = 20
    Interpolate self.position Y to 160

    It will just go up and down.

  • SocksSocks London, UK.Member Posts: 12,822

    @diegocs said:
    I think if you try interpolating the y position to a random value and when it reaches that value just interpolate the [y position] to another random value and so forth? like a loop thing

    (I'm guessing you mean 'y position'].

    If you interpolate an object's position in one direction to a random value - and then in the opposite direction to another random value, then the object has no limits to its travel.

    For example, an object interpolating like this, up and down, in a GameSalad project can leave the scene. A simple illustration of this: imagine a random range of 0-100 pixels, the object goes down by 1 pixel, and up by 98 pixels, down by 54, and up by 86, down 7, up 27, down 65, up 100 . . . . etc, it soon leaves the scene.

  • ShortAxe5ShortAxe5 Member, PRO Posts: 69

    I'll give it a try. Thanks guys! o:)

Sign In or Register to comment.