Randomising Quiz Questions
mynameisace
Hull, UKMember Posts: 2,484
Hey
I've been lurking around the forums since I downloaded GameSalad a week ago and have learnt loads. I'm making a 'Monkey Island' type game which I've decided to put on hold for a bit until the next update of GameSalad as it's going to be a pretty hefty game and want all the improved optimisation, etc.
I've decided to keep on making less intense games until the update and was just about to start a 'Who Wants to be a Millionaire?' style quiz but came up with a problem.
I want there to be, for example, 10 different questions before the end. For each of the 10 questions I want to randomise between 10 questions. Well, this is a bit mental to type and make sense.
There would be a hundred questions in total with 10 different 'hardness' levels until you complete the game. For each hardness level I want it to be a random question.
If you understand this alone you are a genius. If you can also help me, then you deserve a cuddle from Einstein (the alive version, not the dead decomposed version)
Thanks
Ace
I've been lurking around the forums since I downloaded GameSalad a week ago and have learnt loads. I'm making a 'Monkey Island' type game which I've decided to put on hold for a bit until the next update of GameSalad as it's going to be a pretty hefty game and want all the improved optimisation, etc.
I've decided to keep on making less intense games until the update and was just about to start a 'Who Wants to be a Millionaire?' style quiz but came up with a problem.
I want there to be, for example, 10 different questions before the end. For each of the 10 questions I want to randomise between 10 questions. Well, this is a bit mental to type and make sense.
There would be a hundred questions in total with 10 different 'hardness' levels until you complete the game. For each hardness level I want it to be a random question.
If you understand this alone you are a genius. If you can also help me, then you deserve a cuddle from Einstein (the alive version, not the dead decomposed version)
Thanks
Ace
Comments
Try searching for "Random" in shared projects in GS, mayhaps?
Thanks for the help. I've tried searching for random tutorials and not found anything so far. Could be me being a complete retard though... That happens a lot
Ace
Ace
I think you are looking at this from a player's view...not from your developer's perspective.
10 scenes...one for each level of hardness
10 game.Attributes for qx # in Index or Integer format
(of course, you could do it in one scene creating another variable for currentLevel and one qx attribute for randoms for referencing each level. sorta: if Level = 10 then random(90,100)
in your scene you will need:
--off screen randomizer Actor:
[Change Attribute] game.qx to 0
(in your level changes you need to set to 0 again)
[Rule] if game.qx = 0
[Change Attribute] game.qx to random(1,10) [e]
--on screen qx Actor
[Rule] if game.qx = # then Display Text]
I would suggest that you only have 2 or 3 qxs in your try-out, so you don't get mind boggled...also put all your #s & qxs in a [Note] and put that [Note] in MyBehaviors to drag to each scene so you can easily reference them. You also might want an Actor to just Display Text game.qx [e] so you can keep track of function and where you are. (mine is on the randomizer as that is on screen for testing.)
OMG...this confused me! I tried it very small..and it seemed to work.
Create an integer for each hardness-level. Like L1, L2 .... L10.
Create a behavior for your start button, like;
Every 2 seconds - change attribute L1 to random(1,10)
Then;
When actor receives - touch is pressed
When attribute L1 is 1
Change scene to easyquestion1
When actor receives - touch is pressed
When attribute L1 is 2
Change scene to easyquestion2
ETC.
Alternatively you could have it set so that when it's touched it changes L1 to random(1,10) and then have rules of when L1 = 1 go to scene easylevel1, etc. without having it change on a timer.
I hope that is SOME help. I know it probably isn't. Sorry >.<' I've had about 4 hours broken sleep in around 36 hours now. I'm not thinking that clearly.
Still - on the plus side, my posting bumps this up again, so hopefully someone with skill can answer
we is so in sync!
maybe we should collaborate on a game!
MH
Thanks a lot for the answers, I'm just doing the artwork now and I'll try it later, let you know how I got one
Thanks again
Ace
I have 10 images of 10 questions that are all the same hardness. Would the best way to be create an individual scene for each question and then when the start button is pressed, somehow make it so it goes to one of the 10 random scenes?
I could then use the same thinking to get from level 1 to level 2 I'm guessing?
Thanks
Ace
1 scene for each level (10 scenes in all unless you opt for all in one scene with random qx in the #range for the currentLevel)
1 questionDisplay Actor for your images
--with a dot.png (small transparent image)
add all your images to your project
then for each # of qx variable [Change Image] to the appropriate qx image and
[Change Attribute] for correct Width; and for correct height
ah...making a demo for you...if there isn't already one..
will include the image info. (and dot.png)
be patient...have 3 grandkids here today!
MH
Thanks a lot!
Ace
Quiz Demo
ah the gfx display sloppy...but too hectic a day to worry about it!
MH
I'm just doing some more artwork on Photoshop on my PC, I'll check out the Demo as soon as I finish that.
Thanks again
Ace
The reason I was thinking I would need a separate scene per question is because each image will have to react differently to where the player touches. For example, if the image looks like this:
Q. 1 blahblahblah blah
A.1 Wrong A.2 Correct
A.3 Wrong A.4 Wong
And the other randomised image looks like this
Q. 1 blahblahblah blah
A.1 Wrong A.2 Wrong
A.3 Wrong A.4 Correct
Then the user would have to tap the image at a different point to trigger the correct answer button.
Is that possible?
Ace
add the variable in the answerActor's Attributes Section
[Rule] if game.qx = #
--[Change Image] to your answerImage for that qx
--[Change Attribute] self.Answer to the correct answer
--[Rule] if touch is pressed
----if touch.X = x of correct answer ± 10 (allow for finger-tip width)
----if touch.Y = y of correct answer ± 10
--add behavior for correct
--Otherwise
----add behavior for incorrect
You will need a set of this rule group for each answer.
If you are using 1 image listing all the selections for the answers....make sure you get the x,y coordinates right. I put the display of mouse x,y in the demo.
I thought I put an answerActor in the demo...though not on screen as it is invalid pseudo-code.
MH
open your GS...
on 1st screen skip "New Project" and "Recent Projects"
click on "Shared Projects"
Quiz Demo should show up...or search in the Filter [ ]
and since QD is editable...
Click on the pencil next to the icon for QD
the demo will open in your GS
you can see all coding used...
copy any code that will be of use to you
save QD for reference or not...
MH
Thanks a lot for the help!
Ace
I'm getting there with it and just had idea after idea for games whilst on the bus, got loads I need to get on with when I'm back tomorrow.
Thanks again for the help, I will get it in my head, I'm determined lol
Ace