Problem with move to position.

moop62moop62 Member Posts: 5
edited September 2012 in Working with GS (Mac)
Hey im creating a jigsaw puzzle game where the pieces move back to their original position if they aren't placed correctly.
only problem is that occasionally when moving back the pieces will just keep moving until they have flown off the scene, and they never come back.
It works fine every time with a simple change x,y to that position, but I think haveing the pieces fly back looks better.
Is this a known problem/can anyone healp me out?

Answers

  • carlblanchetcarlblanchet Member Posts: 755
    been there lol
    @uptimistik's answer will do the trick
  • moop62moop62 Member Posts: 5
    Ok well that works as far as getting rid of the original problem, but now if while interpolating the piece moves across 'goal' location (where it should be in the puzzle) it moves back to the start position but can no longer be dragged.

    I'm guessing this is because of the code I put in to stop the piece from being moved off the correct spot once it is in place, but it ignores the code that positions it on the spot due to interpolation being uninteruptible.

    I got around that problem by putting in a check that it only stops if the mouse is also within the goal area when the puzzle piece is. There still the problem that if the person moves their mouse back along the same path quick enough it will trigger the bug, but on the ipad using touch this shouldn't ever happen. I'll include a reset button on the challenge that if the bug does happen the player can finish the challenge properly but if anyone can offer a better solution that would be excellent.

    also big thanks to @uptimistic and @carlblanchet for getting me through the first problem and introducing me to interpolation, I was wondering what it did :)
Sign In or Register to comment.