How can i drop

Get help using Construct 2

Post » Mon May 02, 2016 8:33 am

i made cards with darg and drop behavior. How can i drop card in free space(position). if i dropped card in position and there is another card in that position the second card back to its recent position.
B
52
S
18
G
10
Posts: 209
Reputation: 8,466

Post » Mon May 02, 2016 8:42 am

I'm not sure if this is your problem

if you start dragging then you store the XY as a variable and if on drop is overlapping with objCard then set position to variable.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 02, 2016 9:04 am

Can you write steps ?
B
52
S
18
G
10
Posts: 209
Reputation: 8,466

Post » Mon May 02, 2016 9:19 am

Here is a version (not the best, but works)
just make an instance variable to objCards

Image

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 02, 2016 9:28 am

didn't like the version I made.
So here is the better one - that doesn't have flaws

Image

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 02, 2016 9:40 am

In your first example all cards move to the same position
B
52
S
18
G
10
Posts: 209
Reputation: 8,466

Post » Mon May 02, 2016 9:45 am

first example
No, only the one card you drag gets a new position (that's what the instance variable is for). Except - this is the flaw - if you overlap with two cards, two of them get a new position - could be easily fixed, but version 2 is better and so there is no need for that.

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 02, 2016 9:51 am

Yes it's better than another one, but i don't want cards move to top of layer!
B
52
S
18
G
10
Posts: 209
Reputation: 8,466

Post » Mon May 02, 2016 10:07 am

Here is a version that doesn't change the order

Image

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon May 02, 2016 2:18 pm

@fm4fanAT Thank you very much.
B
52
S
18
G
10
Posts: 209
Reputation: 8,466


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 2 guests