How do i do probability to Spawn?

Get help using Construct 2

Post » Wed Apr 10, 2013 6:59 am

Hi Guys,

I am thinking about how to do a probability of spawning different sprites.

I have a set of 6 different sprites to spawn. Currently I am using int(random(5)) to get a random spawn of the sprites.

What I would like to do is to make the spawning of these sprites based on a probability?

Sprite 1 - 25%
Sprite 2 - 18%
Sprite 3 - 25%
Sprite 4 - 12%
Sprite 5 - 15%
Sprite 6 - 5%

And also I will like to be able to adjust the probability based on the events that happens during runtime.

A note also, is that currently my sprites are all stored within 1 sprite object with each sprite as a frame in the animation.

Hope to get advise from the community! Thanks
Posts: 5
Reputation: 760

Post » Wed Apr 10, 2013 7:25 am


if less than 25 -> Sprite 1
if greater than 25 but less than or equal to 43 -> Sprite 2

Project Lead of Zems Online Card Game

Producer at Impulse Limited
Posts: 677
Reputation: 5,234

Post » Wed Apr 10, 2013 7:43 am

Thanks Excal,

I found this in the FAQs.. should have done it earlier.

This would be more likely I would like to do. Thanks

Sorry for the post.
Posts: 5
Reputation: 760

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, marcinkowski, Shenkai the ssj, Solomon, Yahoo [Bot] and 19 guests