0 Favourites

Can I pair one animation frame to multiple animation frames

  • 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!

  • 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!

  • 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!

  • 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!

  • Are you using a sprite (a different object) for each card ?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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!

  • 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.

  • 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

    Thank you again (and again, and again!). It is no rush, whenever you have time is perfect! I just appreciate your help so very much.

  • Here is the example:

    (Disclaimer: I am NOT an artist)

    https://drive.google.com/file/d/0B-xiqK ... sp=sharing

    Also, note this will only work for 2-way matching. If you have to match 4 or more, the Array object won't work for you.

  • KHC

    I took Kittiwans' completed tutorial capx for the Memory Match Game and made a few modifications. Check it out and see if this is what you are trying to do!

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

  • gumshoe2029

    Thank you for this example. After looking through it, I have come to realize that I have some studying to do when it comes to arrays. Your example will help me for sure. Thanks for getting this together for me so quickly, you're amazing!

    SimoneT

    When I saw this, I started laughing like a mad woman. THANK YOU thank you THANK YOU A BILLION TIMES! This is exactly what I was thinking, and you have taught me so much with this! I will be honest, my event sheet looked much different than yours (and not in a good way) hehe

  • SimoneT

    nice simple wordmatch game! thanks for sharing

  • gumshoe2029

    Thank you for this example. After looking through it, I have come to realize that I have some studying to do when it comes to arrays. Your example will help me for sure. Thanks for getting this together for me so quickly, you're amazing!

    No problem.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)