Matchgame Coding question
jweaver911
Member Posts: 439
Hey guys, I'm about to embark on a challenge. I have a kids game that is basically a match game. However the twist is the character announces what object to "match" out of a crowd of objects. So for example, the actor shows a hotdog, and you have to click the matching actor from amongst other actors.
Any ideas as to how to make this announcement of the preferred choice, random? I know without and array or some form of script this might be tough. I would prefer this to only occur for the remaining available choices which are on screen.
Thoughts?
Any ideas as to how to make this announcement of the preferred choice, random? I know without and array or some form of script this might be tough. I would prefer this to only occur for the remaining available choices which are on screen.
Thoughts?
Comments
On the easier levels I would only have about 3-4 choices to begin with.
you would need an actor that makes the random choice and plays the audio. this actor needs an integer which you would initialize with a random number (1 through max choices). it also needs a boolean for each option(call them self.1used, self.2used..etc.). you then need a rule for each option that checks to see if they are a match to the random number. if one is and it hasn't already been used (check self.1used.), you change the the game level boolean corresponding with the choice to true, you change self.1used to true and you play the audio. if it does match the random value but it is already marked as used, you need to generate a new random number which would start the process over again. if it does not match the random value, do nothing.
the objects the player will touch need a boolean attribute to track if they have already been used. when touched, you check to see if the corresponding game level boolean is true. if it is, you change it false, change self.used to true, and do something to tell the player they were correct.
I was kind of on the same path that you started with in the first and second paragraph. Just wanted to make sure there wasn't an easier way.
Can you randomize which scene is chosen?
http://gamesalad.com/game/play/54660
I have a lot of game attribs which include
attrib spawncounter (integer) to count number of actors spawned
attrib spawnactor (integer) determine specific actor to spawn(out of a pool of 10)
Then I have game attribs for each actor1-10 that determine whether spawned or not (i.e. actor1spawned...etc.)
so my rules currently look like this
I have a click designate a changeattrib to create a random "Spawnactor" attrib (1,10)
then I'm trying to use my spawnpoint actor with a rule like this...
When Game.Spawncounter <or= 4 (Because I currently only want 4 random actors to pop up)
Timer Every .2 sec
When ALL Conditions Valid
if attrib game.actor1spawned = false
if attrib game.spawnactor = 1 (this is the number referring to this particular actor: out of 10)
then change attrib actor1spawned to TRUE (for checking for dupes)
then change attrib game.spawncounter to +1 (to add to the count, so that it will stop)
SPAWN Actor1
Otherwise
Change attrib game.spawnactor random(1,10)
And then I have this part repeated respectively for each of the ten different types of actors.
So My hopes would be for it to stop when the count reaches the number I desire which for this example would be four. I'm also intending for it to check for no duplicates at the same time.
But I'm having trouble getting the logic to work right, and I know I should have multiple spawn points but that was getting way too confusing and from what It seems, I don't really need it.
Any further help would be much appreciated.
~ J-Dub
Thanks!