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

Just started using Construct 2? Post your questions here

Post » Sat May 10, 2014 9:47 pm

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.
You do not have the required permissions to view the files attached to this post.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Sat May 10, 2014 9:57 pm

[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.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Sat May 10, 2014 10:22 pm

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.
You do not have the required permissions to view the files attached to this post.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Sun May 11, 2014 12:14 am

This was exactly what I was looking for. Thank you very much sir.
B
15
S
4
Posts: 31
Reputation: 1,267

Post » Fri Aug 11, 2017 11:58 pm

Perfect solution, thank you very much FragFather!
B
5
S
1
Posts: 1
Reputation: 327


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests