Help with character movement
Hey everyone, based on feedback on my game, I need help with character movement. See link for reference (https://itunes.apple.com/gb/app/1-of-9/id1202579425?mt=8)
My issue:
the way the character movement happens now is that when someone swipes a direction (to move the character), depending on the direction (and as long as it doesn't move outside of the grid) then the character changes its position to position+65 (the space between cells). This works, and works perfectly.
However, based on customer feedback, I want it to slide from cell to cell. So I want it to interpolate itself from currPos to currPos+65 over .2 seconds. My issue is when I do this, it just infinitely interlopates to curr position +65. I tried putting rules where (assume the block is in the bottom right corner). say that is position 0. Then when curr.pos is 0, I swipe right, I interlopate the position to 65 over .2 seconds. Also, if the position is 65 and I swipe right, then interpolate the pos to 130. My issue is, even with this approach, it interlopates from 0-->65 then instantly 65-->130. So instead of interlopating 1 spot, it goes the whole length. How can I make it interlopate to a direction (0-->65) and not instantly going from (65-->130)?
Thanks
Comments
Your rules are probably set up incorrectly. Would need to see rules.
The problem with interpolate is it's persistent.
Ball in position 0, interpolate to 0+65 = get to 65. A fraction of a second later, ball in position 20, interpolate to 20+65 = get to 85. The target keeps moving because the actor does. It's kind of like tricking a donkey by dangling a carrot in front of it while sitting on its back. It will run to eat the carrot, but because you sit on the donkeys back, the carrot keeps moving, and so the donkey will continue to run until it drops from exhaustion.
You have two options:
my_X+65
. Since you saved to my_X exactly once with change attribute, it won't slide and the target of the interpolation won't constantly change.Or constrain.
While position is less than target
--Constrain position to position+X
Constrain can be interrupted (not persistent)
True: