How do I use the pick by evaluate?

Get help using Construct 2

Post » Mon Apr 18, 2016 1:35 pm

I want to drag a sprite and when it's close enough I want to make the sprite next to it move away. I tried with the pick by evaluate event but it's not working. what's wrong? I added the .capx.

http://www.yourfilelink.com/get.php?fid=1200044

edit: here's the .capx
http://www.yourfilelink.com/get.php?fid=1200060
Last edited by andreone on Mon Apr 18, 2016 3:10 pm, edited 1 time in total.
B
13
S
5
Posts: 55
Reputation: 1,085

Post » Mon Apr 18, 2016 1:59 pm

I can't open that file because of the MoveTo plugin, can you take it out for this example or is it necessary for this specific effect?
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 201
Reputation: 3,460

Post » Mon Apr 18, 2016 2:32 pm

B
13
S
5
Posts: 55
Reputation: 1,085

Post » Mon Apr 18, 2016 2:34 pm

andreone wrote: I added the .capx.
New_project.caproj


Manual wrote: The main project file in a folder project has the extension .caproj. Note this does not contain the entire project: it is simply a list of other files used in the project. If you want to share a project, the .caproj file is useless on its own - save to a single-file project (.capx) instead.


Image
Image
B
64
S
23
G
7
Posts: 1,482
Reputation: 10,825

Post » Mon Apr 18, 2016 2:44 pm

B
13
S
5
Posts: 55
Reputation: 1,085

Post » Mon Apr 18, 2016 6:46 pm

Using good old physics.
https://
drive.google.com/open?id=0B1SSuCVV8v74SzNzVFZIRjZveWM

Using custom movement.
https://
drive.google.com/open?id=0B1SSuCVV8v74MDB5bFR1MU1uVm8
B
33
S
18
G
28
Posts: 2,464
Reputation: 20,892

Post » Mon Apr 18, 2016 8:05 pm

@andreone
The issue is you're checking if a x position is exactly somewhere. With floating point numbers two separate values are seldom equal. It's better to check for a range of values like:

pick family where family.x > position+49
pick family where family.x < position+50
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756


Return to How do I....?

Who is online

Users browsing this forum: marcinkowski and 3 guests