Spawning Actors- different types?
Hi all!
So, as I've said before, I'm pretty new to this GameSalad thing, though I'm getting a little better! And I just need a little help.
I'm building what is basically a whack-a-mole game modified for educational use. Certain actors gain you points when you tap them and others cost you lives. Because of the educational nature of the game, however, it's important to have a certain ratio of "correct" actors to "incorrect" actors.
I have it set up where there are several spawn points in the game that will randomly select an actor. How do I tell it to spawn X many Correct actors and Y many Incorrect ones?
Thanks!
Edit: I forgot to mention, rather than your typical whack-a-mole game, which has actors randomly spawning all over the place, this one has them all pop up at the beginning and simply stay there unless tapped. Just in case that helps.
Comments
Is your ratio always the same (e.g. 2 correct answers to 6 incorrect answers)? If so, this shouldn't be too hard to code.
When you spawn a new actor, if it's a correct actor add one to a game.correctCount integer attribute; if it's an incorrect actor, add one to game.incorrectCount. Then, before spawning, check the ratio and spawn a specific type of actor based on the current ratio.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
The ratio is always the same, yes. I think I must be doing this wrong, though... something in the way I'm telling it to check the ratio must be wrong, because I keep having either not quite the right ratio, or sometimes actors that don't spawn at all.
I should add that the actors don't spawn one at a time. They all spawn simultaneously, so I don't know if maybe that's causing the problem?
It's not actually possible for anything in GameSalad to happen "simultaneously" unless you really work at syncing times between actors. It may look simultaneous because it happens so quickly but there is always an order to how behaviors and rules are run.
If you post a screenshot of your spawning rule(s), I might have a better idea of what you're doing.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
http://i172.photobucket.com/albums/w6/ravenheart737/spawnrules_zpsb3dc0385.jpg
That's what I need to modify. Right now I have four actors, 3 Correct and 1 Incorrect (vowels and consonant). When GameOver is false (so when the actual game scene starts) there are twelve of these spawn points that pick a number between 1 and 4 and spawn an actor accordingly. Really simple stuff. I didn't want to embarrass myself by showing my fumbling attempts at making it check the ratio...
So each of the twelve points spawns an actor that is either a vowel (three choices) or a consonant (one choice) and you want the ratio of vowels to consonants to remain constant? And is that ratio 3 to 1? So for the twelve points, you always want 9 random vowels and 3 random consonants?
Is there a reason you need to spawn actors or could you just have all of the actors already in position and change their value/displayText/Image to reflect their contents?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Yes, that's exactly right! Thanks so much for your patience
It would be infinitely easier to have the actors all in place and just become visible as needed. However, this app is geared toward children, who are amazing at picking up patterns. Rather than learn that "k is not a vowel, don't touch that" they'll figure out before long "don't touch the third one on the first row." Etc. So it becomes necessary to make consonants and vowels appear randomly at these points.
Bumping just in case...
Aaand one last bump before I give up completely.