Fruit Monster Challenges

You’ve made the Fruit Monster Game.  Now we’ll change it, to make it our own.  The basic game is at https://is.gd/DY9EjJ

1.  Change the fruit to a solid color sphere.   Look near the beginning of addFruit().

2.  Have the fruit come in from higher.  When the position of the fruit is set, make the y-value, the second number, bigger.  See how high the top of the screen is.

3.  Have the fruit move faster, or slower.  Look for the setLinearVelocity() function and at the variable called speed.

4.  Use Math.random() to give the fruit some vertical velocity at the beginning.  Note that 200 + 100 * Math.random() will give a random number between 200 and 300.

5.  Use Math.random() to make the fruit fall from the sky, from random places.  Random it up!

6.  Add poison fruits, that appear only occasionally (use Math.random()).  Make them green and have them end the game if they hit the player.  The easiest way to do this would be to have a whole other makePoison() function, much like the makeFruit() function.  Have them enter from a different place, or with a different velocity.  You could add them only occasionally – change the launchFruit() function so that some of  the time it calls “makeFruit()”, and other times calls “makePoison()”.

if (Math.random() < 0.1){
poison_fruit = makePoison();
poison_fruit.setLinear…

} else {
fruit = makeFruit();
fruit.setLinear…
}

7.  Think of other things to change in the game!