This site requires JavaScript, please enable it in your browser!
Greenfoot back
craigv
craigv wrote ...

2012/1/24

how do i get objects to appear from left side of screen?

craigv craigv

2012/1/24

#
I cant figure out how to do this, i want to have balls come from the left side at random positions, sliding across the screen, so far i got: if (Greenfoot.getRandomNumber(200) <10) addObject(new pointBall3(), 0, getBackground().getWidth() - 1 ); though my second line, i think im way off the track of what im supposed to be coding
craigv craigv

2012/1/24

#
i meant right side***
Duta Duta

2012/1/24

#
Firstly, instead of your first line you could just have:
if(Greenfoot.getRandomNumber(20) == 0)
And on the second line have something like the following:
addObject(new pointBall3(), getWidth()-1, Greenfoot.getRandomNumber(getHeight));
And in your pointBall3 class, have the following:
You need to login to post a reply.