How to prevent different combinations?

Get help using Construct 2

Post » Wed May 06, 2015 7:52 pm

I intend to create a game like tangram. I thought to use duplicated sprites as marks (placeholders) but I don't know how to prevent a different combination of sprites that will be correct too. I need some suggestions. Thanks in advance.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,053

Post » Wed May 06, 2015 8:13 pm

You can use couple of sprites for each piece or just have a "sprite variable" that you'll check.

basically if piece's A sprite variable = placeholder's A sprite variable - they stick. Otherwise - they don't.
B
7
S
2
Posts: 68
Reputation: 645

Post » Wed May 06, 2015 11:23 pm

So, I intend to use duplicates of the tangram pieces to mark the right place but I don't know if this is the better solution (I believe not). I thought to use variables too, but the problem for me is to prevent all possibilities. You can build the same figure with several different combinations. For example: one big triangle or two small - one square or two small triangles (inverted too) - a rhombus or two small triangles, etc.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,053

Post » Thu May 07, 2015 11:20 am

Some help, please.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,053

Post » Thu May 07, 2015 11:32 am

It all depends on how you'd like it to work..

Because of the many possibilities you should think of a way to accomodate them all..

I guess overlapping is the first thing you'd want to check
If the square (for example) is overlapped by the triangle, and the triangle fits in the square, you could add conditions for it to go (or not go) to the place it fits..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 07, 2015 11:49 am

Okay. But I don't know how to prevent all possibilities (the same figure can build in all orientations) and how can I associate a shape (as I said, I intend to use duplicates to check the sprite) with two others.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,053

Post » Thu May 07, 2015 12:34 pm

So I guess you allready got this far?

https://dl.dropboxusercontent.com/u/485 ... tance.capx

Very dirty method to get the first part working, by the way..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 07, 2015 12:51 pm

Offcourse it would be much nicer to check the distance between the two objects and if close enough have them move to the destination.
The same way you could check collisions and overlap with different objects and if (for example) the triangle fits inside the square have it go to the fitting position based on distance and overlap, or not..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 07, 2015 1:06 pm

LittleStain wrote:So I guess you allready got this far?

https://dl.dropboxusercontent.com/u/485 ... tance.capx

Very dirty method to get the first part working, by the way..



Yes. No problem with this.

I used your example to create another one that represents what I need to understand.

https://www.dropbox.com/s/u7hcn97o2hmi2 ... .capx?dl=0

I have to fit all the pieces in the figure using all possible combinations (use the spacebar to rotate the pieces).

I really appreciate your help.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,053

Post » Thu May 07, 2015 1:16 pm

ok.. A few questions..

Why is there a sprite3, sprite4 and sprite5, when they are exactly the same object as sprite?
Why not use instances?
Why is there a drag and drop behaviour on both the sprites and the family all the sprites are in?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: boybacteria, dop2000, Microbex, richcoz81, totoe and 31 guests