Can I pair one animation frame to multiple animation frames

Get help using Construct 2

Post » Thu Jun 23, 2016 10:47 pm

Hello Scirra Universe!

I'm Keri, and I am new to using Construct 2 (in fact, I am new-ish to game development). I have been playing around with Construct 2 for a while now, read through hundreds of posts, and watched numerous tutorials. I am ready to make my game, but before I do, I have a question about matching, or pairing items by frame.

I recently watched through all of Kittiwans' tutorials for the Memory Match Game (if you still view the forums, thank you so very much for making these tutorials). In the video, she mentions one way of pairing up two cards which is great (animation frames side by side), however, I need something (that in my mind) is way more complicated... hopefully not. After 3 days of searching - using about 1000 different search terms, and a day of just "trying things" in Construct 2, I need your help!

I would like to know if there is a way to pair cards by using only their animation frame numbers? I want my first animation frame to make a match with all the following animation frames, and all the other animation frames to only match with the first animation frame. (frame0;frame1)=match; (frame0;frame2) = match; (frame0;frame3)=match etc.

For instance: I have my CardBack and CardFace animations. Under CardFace I have 2 different types of cards - my letter card (first frame) and my word cards(remaining frames):
(1st frame) the letter (a); (2nd frame) word that begins with a (aardvark); (3rd frame) word that begins with a (apple); (4th frame) word that begins with a (anchor) etc. --it will continue on with b--- (5th frame) letter (b); (6th frame) word that starts with b (bat) etc.

If there is a way to pair my frames, I would greatly appreciate the help. I promise I am not asking for help making the game, just going in the right direction with this silly issue. I am just totally lost atm. If there is no way to do this... is there a way to pair the cards the way I need? (I didn't know if families was one way to do this, though I do not currently have the full version so families is not possible).

I had a thought (please don't laugh if I sound like a dum-dum), that maybe I could pair the frames (like mentioned above) in a global event sheet somehow, and use the same variables for each level (abc, def, ghi, jkl, etc) in their respective event sheets?

Thank you so much for your time, and I look forward to learning from you all! :D :mrgreen: :D
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Fri Jun 24, 2016 12:16 am

Hi Kerri,
I have a way, I think. Do you plan on having the same ratio of children to parent cards throughout? (or "letter" to "word"). If so, this could work.

Say that frame 0 is the CardBack, LetterCardA is frame1, WordCardA1 is frame2, WordCardA2 is frame3, WordCardA3 is 4 and WordCard4 is 5, and assuming you have the same amount of "WordCards" for each letter, you can match cards by their multiple of 5 (1 letter card + 4 word cards).

Ok now if you ask if ceil(Card1.AnimationFrame/5) == ceil(Card4.AnimationFrame/5)
*you can change the "5" with a global variable in case you plan on changing the number of children cards...

Let me know if this makes sense to you!
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Fri Jun 24, 2016 5:25 pm

Hi SimoneT, thank you so much for your response, and sorry it took me so long to reply (my brain shut off after I wrote my post :) )

N-e-ways. My game is going to work similar to this:

It is for kiddo's, and will be a "Beginning Sounds" game. I would like to start with the first level focusing on A and B. It will be a repetitive game (where the child chooses the beginning letter and the picture/word that it belongs with. So, here is a sort of set up of my thinking:

Memory:

A_letterCard A_wordCard1 B_letterCard B_wordCard1 A_letterCard

A_wordCard2 B_letterCard B_wordCard2 A_letterCard A_wordCard3

B_letterCard B_wordCard3 A_letterCard A_wordCard4 B_letterCard

B_wordCard4 A_letterCard A_wordCard5 B_letterCard B_wordCard6 etc

---The cards will be set up in a 6x4 grid with 24 cards at a time--

I have a total of 10 A word cards and 11 B word cards. I plan on having the game rotate 3 times (with shuffle, so it won't actually be in the above order), while randomly throwing in the pairs to match for each rotation. The card back is a simple image that just has AB on it for the specific set.. or deck I guess... of cards.
I am not sure if this is what you are asking for? Please bare with me... I am such a newbie

I am not sure I completely understand what you mean when you said that I can match cards by their multiple of 5. I am looking at your example (I am assuming that the ceil(Card.AnimationFrame/5)==ceil(Card4.AnimationFrame/5) refers to what you mean? In this case, are we simply calling the card from the list of 5 (letter card + 4 word cards)? So, if I have 11 cards, will it be /11 instead of /5, or does it need to be an actual number divisible by 5? (So, instead of /11 I would need to go with /10)? I am so sorry if I am way off course here, I am just trying to fully understand and learn this program.

Thanks again SimoneT, your help is very much appreciated! :D
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Fri Jun 24, 2016 7:07 pm

Ok, I'll try to make it clearer ;)

I see that you plan on having each word card have a matching letter card to pair with. In that case, you should probably add two instance variables to your cards:

1. CardType(text): "Letter" or "Word"
2. CardLetter(text): "A" or "B" etc...

Then, to check if the cards match:

Event: If Card1.CardLetter and Card2.CardLetter are the same
sub-event: Card1.CardType is not the same as Card2.CardType, then match
Else, no match.

Let me know if this makes sense!
B
16
S
9
G
5
Posts: 74
Reputation: 4,120

Post » Sun Jun 26, 2016 1:47 pm

Are you using a sprite (a different object) for each card ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Jun 28, 2016 9:15 pm

@SimoneT,
Thank you for your response, I apologize for not writing sooner (I promise I didn't just take off). I have tried the second method you suggested, and am going to continue trying until I figure this out. I feel like I am at a point of over-thinking what I am doing. Thanks again, and I will let you know what ends up happening.

@99Instances2Go
I started with one sprite (Card Back) and added the images for the (Card Front) into a second animation frame (like the tutorial video). This second animation frame will pair the images, but only if they are side by side.
So... I have the LetterA and 10 LetterAWord pictures to match to the letter a (then the LetterB and 11 LetterBWord pictures to match to the letter b, etc).
Then, because I couldn't figure out how to match animation frames, SimoneT explained his method, which I am assuming is a sprite for each object... So yes.. I guess I am using one sprite per object. :)
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Thu Jun 30, 2016 6:06 pm

KHC wrote:I feel like I am at a point of over-thinking what I am doing.


This a common problem for me also, and one of the main reasons I always try to follow KISS (Keep It Simple & Stupid) methodology.

Assuming I understand your problem correctly, you are trying to create links between specific animation frames for cards that match. You will probably need to store these relationships in a metadata object somewhere else (maybe a JSON array/object?) and then reference that object whenever you are trying to determine matches.

Something like:

[[0,2],[1,4],[6,3],... etc]
where the numbers in this array of arrays are the animation frames in question.

This is probably not organized well. Maybe you could even do a table like:

0 1 2 3 4 5 6 7 ...
0 x x
1
2
3
4
5
6
7
.
.
.

then have some character that indicates whether the two animation frame indices are related. This would also prevent overlaps in your data.

You might even be able to make this work in a simple 2-D construct array where the array indices are corollaries for the animation frame indices.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed Jul 06, 2016 4:29 pm

@gumshoe2029,

Thank you for your response as well! I read this last week, and have been working with Construct ALOT, trying so many different ways to get this to work. I am actually dreaming about it... I wake up in a cold sweat thinking about arrays and how to input the information (I used to dream about WoW...but that was so much different, it's like I am working in my sleep now).

So, I hate to ask you, but would you mind giving a little more detailed of an answer when dealing with the 2-d array in construct? I know how to make an array, but I am struggling figuring out how to match the one item in the array to the rest (I am not sure what this would look like as far as the event sheet goes). I have read through information about arrays and such, and maybe I am overlooking it or just completely ignorant on what exactly it is I am looking for, But either way, if you could provide a little more assistance, I would be very grateful. If not, I completely understand. I just thought I would ask. :)

@SimoneT
I am still trying to see if your way will work as well. I think I am doing too much, and need to slow down and, just like gumshoe said, KISS! I will update as soon as I can (or can't) figure this out. Thanks again hun!

Thanks!
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Wed Jul 06, 2016 6:31 pm

KHC wrote:I am actually dreaming about it... I wake up in a cold sweat thinking about arrays and how to input the information


I actually do that too, lol. I solve some of my more complicated problems in my sleep. I'll make up an example when I have more than 5 mins to spare... maybe later today or tomorrow.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed Jul 06, 2016 6:47 pm

@gumshoe2029

I also solve problems in my sleep, isn't it weird? Lately I feel so confident when I wake up, but when I actually open Construct... it all leaves me. It's almost as if opening the program erases my slate lol. I know I will get it eventually, and what I dream about will actually make sense at some point, I just hope that point is soon :P

Thank you again (and again, and again!). It is no rush, whenever you have time is perfect! :D I just appreciate your help so very much.
B
9
S
1
G
1
Posts: 14
Reputation: 480

Next

Return to How do I....?

Who is online

Users browsing this forum: bilgekaan and 8 guests