[SOLVED] Snapping using Instance Variable

Get help using Construct 2

Post » Mon Nov 02, 2015 2:58 pm

Hey everyone, been scratching my head for hours on this.

I have a "card" that should snap to an empty placeholder.

I have the placeholders in a family called deck that has an instance variable called "hascard"

When the card overlaps with the placeholder, it sets the variable to 1
When overlap is inverted, sets the variable to 0

If the card is dropped below the black line, it should snap to a placeholder with the variable value being 0.

Is this possible when using families?

I have linked the capx if you wanna take a look

https://onedrive.live.com/redir?resid=E ... ile%2ccapx
Cheers,
Last edited by ryrydawg on Tue Nov 03, 2015 3:12 am, edited 1 time in total.
B
18
S
2
Posts: 48
Reputation: 896

Post » Tue Nov 03, 2015 12:32 am

Hey Ryry,

Yeah it is possible (with or without families) and you were close but you just needed to add 1 last instruction, the location of where you want each card to snap back to.

Here you go: https://db.tt/F6Ypg0LE
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Tue Nov 03, 2015 2:05 am

I have looked at the capx and it is hard dealing with familiy when you are using DragDrop behaviour too.
So we need extra condition dealing with this behaviour to make your code works with some modification.

For some reason family instance variable doesn't work like I expected. But I manage to work around the code:

snapping_back

Deck snapping is working now. Hope it helps.
ImageImage
B
114
S
51
G
24
Posts: 790
Reputation: 23,480

Post » Tue Nov 03, 2015 3:06 am

@GenkiGenga
@alextro

Thanks so much for the help!

Can't believe how simple it was :shock:

Have a good one!
B
18
S
2
Posts: 48
Reputation: 896


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests