Interpolation bugs?

I'm running into an issue using interpolation. So here's a rough idea of the look:

XXXX
XXXX
XXXX

My goal is to have it so that a group of actors of the same type move down in unison if I touch one of the actors. Originally I had this code:

Actor receives touch
Change attribute self.positionY-> self.positionY-130
Destroy actor
(Also had an overlap/destroy actor rule)

This worked. All the actors would shift down after an actors received touch, and the one that was actually touched was destroyed, but it wasn't smooth, and created ghost images.

I then replaced the change attribute to interpolate. I set this code:

Actor receives touch
Interpolate self.positionY -> self.positionY -130 over 0.1 seconds linear.

Now all of the actors move completely off screen. Am I doing something wrong or is there a bug with interpolate?

Comments

  • crestwoodgamescrestwoodgames Member Posts: 191

    Interpolate will continue to update your "destination" value causing this problem.

    A way around this would be to store your posy in a local variable. Then interpolate self Pos y from that local variable to local variable-130.

    Ex.
    Create a variable called store_Pos_Y in the actor.

    when touch is pressed
    Change Attribute store_Pos_Y to Self.pos.y
    Interpolate Self.pos.y to store_Pos_Y -130

  • IntellimigentIntellimigent Member, PRO Posts: 8

    @crestwoodgames said:
    Interpolate will continue to update your "destination" value causing this problem.

    A way around this would be to store your posy in a local variable. Then interpolate self Pos y from that local variable to local variable-130.

    Ex.
    Create a variable called store_Pos_Y in the actor.

    when touch is pressed
    Change Attribute store_Pos_Y to Self.pos.y
    Interpolate Self.pos.y to store_Pos_Y -130

    I kind of understand what you're talking about, but what do you mean by storing the posY in a local variable?

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    @Intellimigent said:

    @crestwoodgames said:
    Interpolate will continue to update your "destination" value causing this problem.

    A way around this would be to store your posy in a local variable. Then interpolate self Pos y from that local variable to local variable-130.

    Ex.
    Create a variable called store_Pos_Y in the actor.

    when touch is pressed
    Change Attribute store_Pos_Y to Self.pos.y
    Interpolate Self.pos.y to store_Pos_Y -130

    I kind of understand what you're talking about, but what do you mean by storing the posY in a local variable?

    Make a new self attribute (real).

    Mental Donkey Games
    Website - Facebook - Twitter

  • IntellimigentIntellimigent Member, PRO Posts: 8
    edited January 2016

    Thanks guys, worked out!

    Edit:
    I just realized how helpful this tip was. It helps me with getting around another bug I was having :D

  • IntellimigentIntellimigent Member, PRO Posts: 8
    edited January 2016

    quick question: if the interpolate behavior is in place in this case, every time I click on one of the actors, they should keep shifting down right? These behaviors are triggered via booleans, so is my problem now with triggering and flipping the boolean?

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

    @Intellimigent said:
    quick question: if the interpolate behavior is in place in this case, every time I click on one of the actors, they should keep shifting down right? These behaviors are triggered via booleans, so is my problem now with triggering and flipping the boolean?

    You've not told us what issues you are having.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Show a screenshot of your code.

Sign In or Register to comment.