How do I pick instances correctly? (Three card monte)

Get help using Construct 2

Post » Tue Jun 21, 2016 11:16 am

Hello,

I'm struggling with using the 'pick' condition. I made a test project of three card monte, where there are three cards at different positions and I'm simply trying to pick them according to their position and then make them switch positions.

It does not work. I've checked everything and my code seems fine (to me). I've encountered problems with using 'pick' before, I guess it might indeed be a bug.

Please check the provided capx file and tell me if my code is the problem or if it is a bug in C2, in this case I'll hand in a bug report.

Capx can be downloaded here: http://www.file-upload.net/download-116 ... .capx.html
B
13
S
3
G
1
Posts: 91
Reputation: 1,477

Post » Tue Jun 21, 2016 2:14 pm

:!: Google is blocking this download site, and the file that came down is an EXE, which is suspicious. I suggest uploading somewhere else (Dropbox).
ImageImageImage
B
71
S
21
G
231
Posts: 3,695
Reputation: 129,366

Post » Tue Jun 21, 2016 4:49 pm

That's strange, I can access the file without any problems. Maybe it's a country-based restriction or something.

Anyway, here is the dropbox link: https://www.dropbox.com/s/ja4tto1xfpu34 ... .capx?dl=0

In C2, I used 'Save as single file', I hope that works.
B
13
S
3
G
1
Posts: 91
Reputation: 1,477

Post » Tue Jun 21, 2016 5:12 pm

Personally, I'd use the LiteTween plugin to do all the work for me. viewtopic.php?f=153&t=70700
ImageImageImage
B
71
S
21
G
231
Posts: 3,695
Reputation: 129,366

Post » Tue Jun 21, 2016 6:27 pm

Your picking method is inefficient, but not the problem. The confusion is due to the way C2 handles negative speeds in the bullet behavior. When you set a negative speed, C2 rotates the current angle of motion 180 degrees, and changes the speed to a positive value. When you enter a speed of -200, C2 sets the angle of motion to 180 degrees, and the speed to 200, effectively moving the object left. Later, when you want to move that same object right, you set the speed to 200, which continues to move the object left since it's angle of motion is still 180 degrees. The object moving to the left, when your other events expect it to be moving right, is the cause of the ultimate overlap.

The simplest fix would be to add an action to event 6 to set all the card's angle of motion to 0 degrees before setting their speed.
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Tue Jun 21, 2016 6:33 pm

@zatyka :

Great! Now it works!

I did not know about the way C2 handles negative speeds. How could anyone know? Is this covered by any documentation? If not, one should definetely add this hint somewhere.
B
13
S
3
G
1
Posts: 91
Reputation: 1,477

Post » Tue Jun 21, 2016 7:01 pm

It may be exclusive to the bullet behavior, I'm not really sure (haven't used C2 in quite a while). I agree that this should be added to the bullet behavior's manual page.
B
63
S
19
G
8
Posts: 341
Reputation: 12,130

Post » Tue Jun 21, 2016 7:12 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 62 guests