Spawning Random Objects
I just finished the Chocobreak tutorial (in the Games Factory 2, trying that out first) and am working on improving it with improved controls, power ups and so forth. I've figured out how to create new objects so I can spawn power ups when the bricks are broken - the problem is, I don't want them to spawn every time.
So my question is:
- How do you create objects that spawn from a random value?
Currently it's "If Ball Golden has a collision with Milk > Create new Champagne Glass"
But I would prefer that it somehow checked for a random number between say 1 and 4, and if it's a 2, it spawns a champagne glass, if it's a 3, it spawns a muffin, and if it's a 1 or a 4 it spawns nothing. How do you do that in the Games Factory? It's a pretty fundamental question for game dev and I've skimmed some beginner and intermediate tutorials with no luck. All the tutorials I've seen just use timers, but I want it based on random chance, pure chance.
Thanks, this is my first post in this forum, liking the product so far. Looking forward to meeting some of you on here.
You can use the built-in condition for that:
Now that you point it out it's blindingly obvious! Thanks!
I'm just trying to get my head around their way of logic, so can you help clarify for me exactly what it means and how to use it?
For example, it comes up with 2 windows. The first says, "Enter the chances" and then "Enter the total number of chances".
So say I said, "Enter the chances = 1" and "Total chances = 4", would that mean there was a 1 in 4 chance of the event occurring? Is that how it works?
Yes, that is how it works.
Thanks :) All working good now.