How do I Get an object to return to original position..

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hello Everyone!

    I am trying to figure out how to get a draggable object (a ball) to return to its point of origin if not dragged to a specific area. (a net)

    My goal was to have several balls on screen that need to be dragged to the net. I thought I would use instance variables to track the position of each unique ball.

    So how do I have multiple instances of the same object track starting positions properly and how do I get them to return to these specific points if not dropped in the goal? Right now if I pick up the ball and drop it, it stays where dropped instead of the original starting placement.

  • [Edit]

    Apparently, i didn't read all the way through the post well enough. The answer I gave was not really what you were looking for I have removed it.

  • Ok, here is a capx with the type of movement I believe you are looking for.

    From what I read, it looks like the problem with how you have it set up is, the event "is overlapping background". This is always true if the sprite is overlapping the background and will always run (even if the background is behind the goal and the sprite is only touching the goal, if the background is behind the goal, it is still overlapping the background).

    I use an else to test if not overlapping the goal. Also, I don't know how much his helps, but I think you should initialize all instance variables in a for each block. I did so in my capx for you.

    Good luck with your project.

  • This was exactly what I was looking for. Thank you very much sir.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Perfect solution, thank you very much FragFather!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)