Hi,
I'm making a fruit ninja game, and I want to make it so that my fruit spawn in between 1/4 of the world's height and 3/4 of the world's height, for their y-position. Can someone please help? Thanks.
Here's the code for spawning apples in MyWorld class:
1 2 3 4 | if (Greenfoot.getRandomNumber( 100 ) < 4 && getObjects(Apple. class ).size() < 4 ){ Apple a = new Apple(); addObject(a, 0 , Greenfoot.getRandomNumber(getHeight()/ 2 )); } |