Creating a Memory Match Game in Construct 2 – Part 5b

so that seems to be working fine now let's add another dimension to the game by adding and sound go to the project's panel and then scroll down until you see sounds right click on that and import sounds and remember that is in the free bundle in the sound FX folder and shift or control click or command click on Mac and click sfx 5 UI one and upgrade one and open those and then just click import on the first dialogue which is telling you which files it's going to import and then click OK on the second one which just tells you whether it was successful or not now you'll notice that there are a bunch of files here there's actually three files for each of the files that we picked and that is to provide support on various different browsers not all browsers support all music formats so you want to include all of them all right let's while we're edit import music so right click on music and choose import music and then go up one folder and then down into the music folder and click both of these matobo's be one files open them import and click OK and now you should see two files here before we can use them we need to add an audio object so go back up in the properties panel to our pop object types right click insert a new object and then scroll down and choose audio and we're ready now to start adding with them in we'll put the music in first go up to the very top to the onstart of layout event add an action on the audio object and we're going to play and then choose the map oglesby music we want it to loop and give it the tag of music this tag is what we'll use to refer to this particular piece of music at any point we need to and in fact let's go ahead and try that out right now by adding an action on the auto audio object to set the volume for that music object 2-10 which is supposed to reduce the volume by about about half now let's add in the sound effects so scroll down to the mouse click event select it and add a sub event and this sub event will be what we want to do is remember when the card was turned face up if you clicked on it again we handled that case so that so that it wouldn't treat it as a match but it would be good to provide an error feedback if a player tries to do it again so if the card face-up boolean instance variable is set now this sub event was placed at the bottom let's go and drag it back up to the top of the sub event list for the on click event and we want to if someone tries to click on a turn that's a card that's already face up we want to play a sound effect SFX 5 not looping and let's give that a tag of error let's copy that whole sub event and paste it and let's let's also handle the case where there is there are already two cards turned up if the player tries to click on a third card we want to sound an error so let's do the test that if go back and if the G count cards picked is greater than or equal to 2 then we want to play that error sound and we also want to provide some audio feedback when a match is found or when no matches found so go down to the event where we do the comparison to see if the cards match and add an action to play the sound effect upgrade one not looping and tag it as match and then also we want to add a sound effect when the cards don't match so go down to this inverted event and add an action again audio play and this time play you i won not looting and tag it as no match all right I think that's it let's go ahead and try it out our music is playing I don't know if you can hear it but it is playing and if we turn over a card and then try to click on again an error sound is played if we turn over a match we hear a different sound if we turn over two cards that don't match we hear you sound and if we try to turn over three cards I may have to be quick to do this we hear the error sound you notice that adding in the sounds makes the delays seem reasonable because the delays are about the right length for that sound alright so we've completed the entire game we've added in sounds and feedback for our player and we still got a little bit of time so I'm going to show you how to implement the alternate version of the card game that we talked about in the first episode alright let's go back to the layout and move over to the side where we let the left side where we have the card object double-click it to open the animation editor and we're going to create a new animation so go to the animations window right-click and choose add animation and let's call this flash card and then select it and will import the frames if you downloaded the the memory match tutorial resources pack before this 5th episode was posted then you may not have these flash card this flash card folder so it's this is under memory match to tour you also don't have this tutorial folder which contains the partially completed projects for each of the episodes anyway go into card graphic the car graphics folder and then under flashcards go into flash cards and you'll see that I've for each card I've added a matching text card that describes what the what the image is I did also change this heart image so that it was a little easier for children to be able to identify for example so you'll see that for every image right next to it is a word describing that image so again the matches are side-by-side so so let's click on the first one and then scroll down and shift-click on the last one click open and that will import all of the the card images then delete this first frame we don't need that one because it's empty and then there's one more thing we have to do and that is we have to change the origin so click on this middle button we're on the right side then right-click on the origin item and click assign to top left and then right click again and apply that to the whole animation alright that's all we need to do to the in the animation editor so let's leave that and now there's only one more thing we need to do to get this game working in the alternate to get this alternate version of the game working and I just go to the event sheet and then locate where we set the card face frame animation and so that's down under the mouse event and it's where the count cards picks less than to set animation to card face and instead we're going to set it to flash cards now let's try running it we forgot to do something important so go back to construct 2 and open the animation editor again and then go change click on flash card and change the speed of the animation 20 and try running it that's better now since we still have our cards unshelled we know exactly where the matches are so this is a great version of the game to use for educational applications now before we one last thing before I go go back to construct and let's set things back to our default to our original setup which was under Global's we had a number of columns originally equal to 6 we had a number of rows original equal to 4 we had our number of cards equal to 24 and let's go back and change that the cards back to card face now you could provide a menu that it would allow the player to choose the kind of game they want to play and you could have multiple sets of cards that they could choose from and then one last thing which is very important and that is to go up to where we turn the shuffle disabled shuffling and let sorry in a belittling Sables so now when we play the game it should play just like the example on the it should play just like the example on the 0 arcade that wraps it up I hope you've enjoyed this tutorial series I've enjoyed creating it for you and I appreciate the positive comments I've been getting and please leave more especially if you have ideas for future tutorials you'd like to see I'd like to hear from you thanks bye

15 thoughts on “Creating a Memory Match Game in Construct 2 – Part 5b

  1. Congratulations on the whole explanation. This series of videos is excellent, the sound however sometimes is very low.

  2. Hi nice Tutorial you just made it, and it works all perfection. Now I have a question, you do it in an older construct version. I have the r146v and I don't know if there is a new way simpler than this?. You know with the new functions and features to modify mine. Thumbs up

  3. Excellent, well presented. You should submit to as they don't cover Construct 2 yet, and please do more. Thanks for all the hard work

  4. Great tutorial! Loved it!
    In the video you said that a menu can be made for the size of the layout, is it at all possible for you to make that your next tutorial!? Pretty please! 😀 I tried it my sefl but failed miserably. Also is it possible to add a hight score table? Thank you for all your hard work and time to put this tutorials together!

Leave a Reply

Your email address will not be published. Required fields are marked *