How do I make a match with random answers (not memory match)

Get help using Construct 2

Post » Fri Jan 27, 2017 6:38 pm

Hello Scirra Universe! I am dropping in, hoping that someone can help me with a little issue I am running into.

I am somewhat new to Construct 2. I have worked over the past few months on the first part of my game, so I am getting more comfortable with the program, but I am still foggy on certain things, and how I should make those things work. Pregnancy brain does not help :|

Today I am here to ask, how do I create a match while having a random multiple answer option. (One main image to 4 answer images, only the answer images can be chosen, never the main image, but at least one of the answer images should match the main image)

Example of what is seen in my game:
Image
So, my question is this: How to I get the letter C to match with CAT, and when the letter C is selected to have the system read that it is a match. Do I need more than one sprite (say MAIN IMAGE is sprite1 and ANSWER IMAGE is sprite2; if this is the case, how do I ensure matches between the two sprites?)


In the memory match section of my game, I had one sprite with multiple animation frames and multiple animations (to loop through all of the images I wanted to use in that particular level). I used the following (thanks to SimoneT) to make matches:
Image.
So, animation frames 0-5 would be my pictures - ant, apple, airplane, anchor, angelfish, arrow and 6-11 would be the letter that matched a a a a a a, 12-17 were my next pictures- bat, bear, ball, banana, bed, bee and 18-23 were the letter that matched b b b b b b. (this is backward from the event sheet I've shown, but this worked easier for me).

I thought to use this method for the question I have today, but I am not sure how to make it work with only one sprite (I don't want the player to select the MAIN IMAGE ever, it should not be possible to click it, but if I give that sprite the action to be clicked for the ANSWER IMAGES, won't that part also be able to be clicked?)

Any help would be greatly appreciated. I have spent the last week looking for possible options to learn from. So far I have found some neat ideas, but those specific ideas would be more of a drag and drop to the correct answer, when I want mine to flip through as the answer is chosen, similar to the games Logo Quiz, or Guess the... trivia only instead of typing in the letter word, the player would choose the correct letter (or image).

Thank you in advance! Again, I do appreciate any help I can receive!
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Fri Jan 27, 2017 8:12 pm

if I understand correctly, you should be able to do this a few ways
one is using array object and load file with config parameters (X and Y) based on sprite frames, or steps/levels.
another option is using @rexrainbow scenario plugin.

there's also a few other ways, but I'll look into this two first, since it will allow to scale easier (i think)
B
37
S
9
Posts: 63
Reputation: 2,255

Post » Mon Jan 30, 2017 10:10 pm

@cristiart,

Thank you for your response. I apologize, but I don't know if I fully understand your advice as far as the "array object and load file." I am somewhat comfortable using arrays (though I will be rereading through the manual and tutorials on arrays again) but I am not sure what you mean by load file. If you wouldn't mind, could you elaborate for me please?

As for the array object, would X = MAIN IMAGES and Y= ANSWER IMAGES? Also, if I end up using an array, will it be with one single sprite with both the "question - or MAIN IMAGES" and "answers - or ANSWER IMAGES" or will I use two separate sprites- one for the MAIN IMAGES and one for the ANSWER IMAGES?

My apologies for these noob questions. I tend to be more of a visual learner, so when I don't have visuals, I tend to ask for as many details as I can get. I am really trying to comprehend, but some of this just seems super complicated (at least for now it does).
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Tue Jan 31, 2017 6:23 am

Use tokenat to match the question and the answer from each list.

Anyway here an example (excuse non-english content ): https://dl.dropboxusercontent.com/u/659 ... andom.capx
ImageImage
B
114
S
51
G
24
Posts: 790
Reputation: 23,480

Post » Tue Jan 31, 2017 8:22 pm

What I was thinking is this:
array.at(x) = level or steps
array.at(Y) = sprite frame for correct answer (answer image)

example array(X,Y):
0,0,1,0,0,0 -> use 1 for correct answer.
So, sprite with frame 2 is the correct answer since array.at(0,2) is 1
I hope this make sense and my example is not to confusing.

You can ajax import the array.json project file with your answers, this way you can use multiple sprites or animation names in multiple rooms.
B
37
S
9
Posts: 63
Reputation: 2,255

Post » Wed Feb 01, 2017 8:09 pm

@alextro
Thank you for your example, the non-English content is just fine (Google translator is a wonderful tool hehe). This example is great, as I can actually see what is happening within the project. Again, thank you, this teaches me a lot, and helps me understand more for what I need!

@cristiart
This example is lovely, thank you very much. I was unsure exactly what you meant, but now I get it (more so than before anyway). I will explore more with your suggestion to get my project where it needs to be. If I have more questions I will ask, as long as you don't mind. Thanks again, you have been a huge help! :D
B
9
S
1
G
1
Posts: 14
Reputation: 480

Post » Wed Feb 01, 2017 8:44 pm

Glad to help :)

On a side note, the easier way to export your array structure so you can easily edit your answers, it's to use array action -> download.
When you run your project it will give you the option to save data.json
Once you save it, open it in your editor. Use that as your array template.
B
37
S
9
Posts: 63
Reputation: 2,255


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests