How do I check instance Y position

Get help using Construct 2

Post » Wed Jul 23, 2014 9:59 am

I've a sprite with 16 frames and I distributed 16 instances of this sprite in 4 x 4 (rows / columns). The player will swap them around and I need to verify that the instances with 0/1/2/3 frames are in the first row, 4/5/6/7 are in the second line, etc, ie, in a vertical position (Y). Could anyone give me some help on how to solve this? Thanks in advance.
Last edited by RBuster on Wed Jul 23, 2014 8:54 pm, edited 1 time in total.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Wed Jul 23, 2014 10:14 am

Compare animation frames and set their position using loop index. To arrange them in grid fashion, you must also set the horizontal position not just the vertical.
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Wed Jul 23, 2014 11:27 am

I show you how to do it on this capx below :mrgreen:
You do not have the required permissions to view the files attached to this post.
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Wed Jul 23, 2014 8:53 pm

@alextro

First of all, thank you very much for trying to help me. I appreciated the example that you did, but unfortunately it is different than what I need or I did not understand your suggestion. Maybe it's my fault for having explained wrong (language barriers). I am attaching an example of my project. Note that the sprites are distributed across the screen, according to the already pre determined location. The player can click on two sprites to swap them. When sprites with the first four frames (0/3/1/2 - need not be in order) are in the first line, the next four frames (5/7/6/4 or another combination of this frames) are in the second line, and so on, the player wins.
You do not have the required permissions to view the files attached to this post.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Wed Jul 23, 2014 9:32 pm

Ah I'm starting to understand what actually you want to achieve. a line group of 4 should be arrange with their own "class mates" to make a match.
I'll try to solve this puzzle mechanism later.
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Thu Jul 24, 2014 12:37 pm

Thanks, @alextro. I'll be grateful
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Jul 25, 2014 10:34 am

One question, do the sprite need to be swapped only to their adjacent neighbor like common match 3 puzzle or they can be swapped other freely?
ImageImage
B
109
S
49
G
23
Posts: 783
Reputation: 22,636

Post » Fri Jul 25, 2014 12:40 pm

Hi @alextro. The sprite can be spawned freely as I did in the example.
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Jul 25, 2014 4:08 pm

@alextro

I'm starting to think the way I used is more complicated. I thought it would be more practical to work with a single sprite and several frames instead of multiple sprites in a family. Although the distribution of instances it's okay, to check the positions is very difficult. I say this because I see that even you are having difficulties and also because I did not receive any other help or suggestion on this topic. I'd better review everything I did, isn't?
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Fri Jul 25, 2014 9:51 pm

Here's one way to do it:
matchSpriteColorsRows.capx
You do not have the required permissions to view the files attached to this post.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Next

Return to How do I....?

Who is online

Users browsing this forum: 25games, jatin1726, kiki4construct, Yahoo [Bot] and 34 guests