How do I make a simple match game?

1 favourites
  • 14 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hello everyone,

    I tried to make a simple match game, for eg. 6 animals pic and its 6 names are given, the user has to click every correct picture of the animals and its corresponding text in order win the game. The structure is ready, I kind of cracked the logic in a very long way which is kind of a nightmare to add more animals set to it.

    Please check this c3p, where I completed the structure and provided 2 sets of animals and its text.

    Please help.

    Tagged:

  • I took a look at your project and yes, there is a much more simple way to do what you are trying. Take a look at this sample project. I added 3 layouts all using the same event sheet with 4 events. It should be relatively self-explanatory. I used a text object for the color name. The only thing you have to do different is, get the animation name instead of the text value of the selected object.

    drive.google.com/file/d/1Nt95lJl46rAwFQkRk0aFc8MyhJZHy9dV/view

  • Thanks InDWrekt for your response.

    I did exactly what you have suggested from that .c3p I'm surprised the way you pulled that on just 3 line of code. AMAZING.

    Few things where I need your assist

    1. The preview pan. I still confused how to do that here :(

    2. When user click the wrong one, how to give a wrong sound,(I already gave the correct ones sound)

    3. How to RESET the highlight's position when user got correct/right. Or can we destroy the highlight?

    4. When user match the 1 pair of animal & text, currently the animal image is destroy, how to destroy the animal text too.

    5. (this question is similar to the previous question) Instead of destroying I have made the opacity to 30%, but it still clickable. How to make it unclickable.

    6. How to add the text when user is correct (Score part), and how to count a total try for that session. (I already made 2 text and 2 global variable not sure where to put it)

    Please check this .c3p I have complied that using your code.

    Please help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 1 - Just set the preview panel objects from the instance variables on the Highlight objects.

    2 - The wrong answer is exactly the same as the right answer just with a not equals. You will also want to only allow it to trigger once while true.

    3 - DON'T DELETE, just move them off the screen. If you take a look at my example, the highlights start off the screen and there is an on screen check.

    4 - The animal text event is exactly the same as the animal event. I am not sure what your question is. If you can do the one, you can do the other.

    5 - In the on-click event, just add a condition comparing the opacity = 100.

    6 - Just increment the values in the events where you play the sounds. Also, if these variables are specific to the level, (meaning the count of tries is reset on each level) I would suggest not using global variables. Instead, add an instance variable to one of the objects on the layout. I would put it on the text object that displays the value. I make this suggestion because global variables are remembered between layouts so you will have to clear them on start of each layout.

    I hope this gets you what you need and good luck with your project.

  • Thank you, InDWrekt, it was so helpful.

    Now having fewer doubts xD

    1. Still unable to crack The wrong answer, for wrong audio sound purpose, please check the .c3p

    2. Added the Score, but how to track the total attempt by the user including correct one and wrong one (Created a "text_TotalTry" text and gave an instance variable)

    3. Struggling to reset the "Highlights"s position.

    Everything else is now cracked :), Once again thank you :)

    Please help.

  • Redownload the project. I made some modifications to it.

  • Redownload the project. I made some modifications to it.

    Thank you so much, Never thought this can be pulled only using just a few lines of code, love you, bro. :)

  • InDWrekt A small doubt, Instead of placing the "ColorNameHighlight" over the text for Text Highlights purpose, how to change the text colour to something else (eg. from BLACK to RED) and return to its original colour when the user clicks to other text.

    (I know "ColorNameHighlight" is kinda compulsory, so I made it invisible on the startup)

    Please help. Thank you.

  • In this image, I modified the tap ColorName action. It is now an on tap action which clears the color of the text with a subevent picking the tapped text object and sets its font size and color. In this version I am also using a global variable instead of the highlights variable.

    As for your comment:

    InDWrekt ...

    (I know "ColorNameHighlight" is kinda compulsory, so I made it invisible on the startup)

    Please help. Thank you.

    Nothing in the code I sent you is "compulsory." You can do everything I showed you many different ways. I try to emphasize this to newer Construct users. Nothing I show you is "The right way." It's just ONE way.

    I have modified the original project. There are now 2 different event sheets. The first layout is using the new event sheet. Instead of using the highlights, I added 2 instance variables to the TriesCountLabel that hold the last chosen color and name. I scale up the selected text and color squares and change the color of the text object. The new version still keeps score the same way, disables colors and names that have been correctly selected and continues to the next level when all 3 colors are chosen.

    Remember, there are many different paths that lead to the same result. The most important thing for you, is to learn the tool and decide which path works best for your needs.

    Good luck with your project.

  • Thank you so much, bro, you are amazing, The way you pulled this things is another level :)

    In this image, I modified the tap ColorName action. It is now an on tap action which clears the color of the text with a subevent picking the tapped text object and sets its font size and color. In this version I am also using a global variable instead of the highlights variable.

    As for your comment:

    > InDWrekt ...

    > (I know "ColorNameHighlight" is kinda compulsory, so I made it invisible on the startup)

    >

    > Please help. Thank you.

    Nothing in the code I sent you is "compulsory." You can do everything I showed you many different ways. I try to emphasize this to newer Construct users. Nothing I show you is "The right way." It's just ONE way.

    I have modified the original project. There are now 2 different event sheets. The first layout is using the new event sheet. Instead of using the highlights, I added 2 instance variables to the TriesCountLabel that hold the last chosen color and name. I scale up the selected text and color squares and change the color of the text object. The new version still keeps score the same way, disables colors and names that have been correctly selected and continues to the next level when all 3 colors are chosen.

    Remember, there are many different paths that lead to the same result. The most important thing for you, is to learn the tool and decide which path works best for your needs.

    Good luck with your project.

  • InDWrekt Bro one question, it might be the lengthy one,

    Thanks to you I have come to this far, I'm trying to make this matching game as an endless one, every time user matches the 6 objects successfully, instead of going to the next stage, it will restart the same layout, but now the 6 animations will come randomly and the corresponding 6 text object will have the name based on the 6 animations name. But two condition, (1), Out of those 6 COLOR, no animation should be repeated, means, Color Red should not be coming twice. and (2), the sequence of either colour image or colour text should be different.

    What I have tried,

    Gave another instance variable to both Color Text & Color image.

    On the start of the layout, set the COLOR animation and "choose("RED", "GREEN", "YELLOW","BROWN""PINK""PURPLE""WHITE""BLACK" . .....//probably 100 different animation)" while comparing when Color_IV = 1. (IV = Instance variable)

    For the text, On the start of the layout, set the ColorText to "Color.AnimationName" while comparing when ColorText_IV = 1. (IV = Instance variable)

    But it's not working, I know I missed a hell lot of things, should have been used array or something, but couldn't able to fig out.

  • In my opinion, the easiest way to do this is with an array containing the animation names. When the game starts, you create the array and fill it. At the start of each round, you pick 3 random items from the array and set the text and image objects from them, then remove them from the array.

    I'm trying to make this matching game as an endless one...

    ...//probably 100 different animation

    I just want to point out, if you have 100 animations, showing 6 at a time and don't ever want an image to appear more than once, this project won't be an "endless one." The most levels the player will be able to play is 17. For an endless game, I would suggest not having the requirement that an image not show more than once. Since the images are chosen randomly, it is very unlikely that an image will appear right after it already has. Statistically, with a high number of images, it should be a while before you see the same image again (with these numbers, an image should show 1 time in 17 rounds).

  • Thanks, bro for your response, :) Actually, I couldn't able to put it properly, "No animation should be repeated" I mean to say that on the same round, COLOR RED shouldn't appear twice, but it's fine if it appears once again on the very next round.

    In my opinion, the easiest way to do this is with an array containing the animation names. When the game starts, you create the array and fill it. At the start of each round, you pick 3 random items from the array and set the text and image objects from them, then remove them from the array.

    > I'm trying to make this matching game as an endless one...

    > ...//probably 100 different animation

    I just want to point out, if you have 100 animations, showing 6 at a time and don't ever want an image to appear more than once, this project won't be an "endless one." The most levels the player will be able to play is 17. For an endless game, I would suggest not having the requirement that an image not show more than once. Since the images are chosen randomly, it is very unlikely that an image will appear right after it already has. Statistically, with a high number of images, it should be a while before you see the same image again (with these numbers, an image should show 1 time in 17 rounds).

  • InDWrekt Finally, I able to crack the random logic using Array, except "then remove them from the array." which you suggested, would like to thank you and dop2000, you guys are awesome.

    One quick question, On this matching game, We have multiple animations (eg, RED, GREEN, BLUE etc) by which we matching with its corresponding text. My question is how to set each animation's frame to random?

    I tried putting

    "int(random(Color.AnimationFrameCount))"

    on the start of the layout, but it doesn't work as expected, sometimes it does make random but its too limited. Please help.

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