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

2013/4/1

How to select a random part of an array list

1
2
JetLennit JetLennit

2013/4/1

#
thank you!!!! i knew about those i just didnt know it was called that and evidently didnt do it correctly
When you call a Splash object, use the constructor to update the image.
1
2
3
4
public Splash(/* Any Variables you Want */)
{
    updateImage();
}
When you make a SPlash object, it will create a splash. Get rid of updateImage() in act(), and it will stop updating constantly.
Oh, looks like you figured it out.
JetLennit JetLennit

2013/4/1

#
Yeah... thanks for both of your help!
danpost danpost

2013/4/1

#
Game/maniac wrote...
setImage(new GreenfootImage("" + getSplashes(), 20, Color.GREEN, null)); might be better though if you add more splashes
I am sure he meant
1
setImage(new GreenfootImage("" + getSplashes()[Greenfoot.getRandomNumber(getSplashes().length], 20, Color.GREEN, null));
JetLennit JetLennit

2013/4/1

#
I actually didn't see that... i just added the getSplashes().length when i added more splashes
Game/maniac Game/maniac

2013/4/1

#
Didn't notice that, thanks danpost
You need to login to post a reply.
1
2