0
\$\begingroup\$

am trying to make a game that have a "whac-A-Mole" game principle enter image description here

The problem that am facing is that i don't want the "enemies" to get out from holes at the same time, not even in a different close times, so i want to keep a minimum interval between each enemy and in the same time i want too keep the feeling of randomization, currently am making it like this :

enemy[0].hidingTime = Random.Range (hidingTimeRangeMin, hidingTimeRangeMax);
            for (int i =1; i < NumOfEnemies; i++) {

                    enemy[i].hidingTime = enemy[i - 1].hidingTime + Random.Range (1, 3);
            }

this fixed the 1st problem, but it will always make the enemies come out in the same order (1st one is faster, and last one is the last to come) i hope i explained it right thank you and have a great day

\$\endgroup\$
1
\$\begingroup\$

Enemies coming out in order is only a problem if enemies aren't identical. If there are some unique enemies, maybe shuffle the enemies first (applying any heuristics about increasing enemy level) and then apply your algorithm. For fairness you could also tweak the random range depending upon the distance from the last enemy, e.g. it takes longer to move the mouse 3 holes than 1.

\$\endgroup\$
  • \$\begingroup\$ shuffling sounds like a good idea, i'll try it and see if it works thank you \$\endgroup\$ – alaslipknot Dec 1 '13 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.