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

2019/4/6

need help with inserting multiple images using arrays

stantwice stantwice

2019/4/6

#
i haven't started the code but the idea is that a random object will appear on my screen and the user will have to input the "name" of the object in order to get rid of it. how do i create an array list for the images?
danpost danpost

2019/4/6

#
stantwice wrote...
i haven't started the code but the idea is that a random object will appear on my screen and the user will have to input the "name" of the object in order to get rid of it. how do i create an array list for the images?
I would think your list of images would be of a fixed length for any single run of the scenario (meaning you could change it between compilations). Therefore an array (as opposed to an ArrayList) would suffice. Also, you can probably kill two birds with one stone by using an array of String type objects instead of GreenfootImage objects. That way, the String values can be the image filename as well as be used to compare to the user's input.
You need to login to post a reply.