IDAT102 – Flash Game 0030-0035

The biggest complaint I got back from people who play tested the game was that bad balls could spawn underneath the player which is unfair. So to prevent this I modified the ballGenBad function to include:

randomX = Math.random() * 800;
randomY = Math.random() * 600;
while((randomX > (ballP1.x - 100))&&((ballP1.x + 100) > randomX)){
randomX = Math.random() * 800;
}
while((randomY > (ballP1.y - 100))&&((ballP1.y + 100) > randomY)){
randomY = Math.random() * 600;
}

If the random number is in the immediate area around the player it will generate a new number until it isn’t.

In addition to this there were a number of other refinements such as seperating the hit tests for each ball type into seperate functions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.