Computer Science Canada Final Project Time! |
Author: | brownni [ Tue Jun 05, 2012 4:22 pm ] |
Post subject: | Final Project Time! |
Hey guys well its final project time and i need some help. I do not know how to make an array filled with images, that i can roll and randomly pick one. I am making a slot machine game and need all of the help i can get! Thanks Brownni |
Author: | Aange10 [ Tue Jun 05, 2012 4:34 pm ] |
Post subject: | RE:Final Project Time! |
That's interesting. |
Author: | mirhagk [ Tue Jun 05, 2012 4:58 pm ] |
Post subject: | RE:Final Project Time! |
create an array, use a for loop to load in the images, and then use a random number generator modded by the size of the array to get a random image. (if you want it to roll you should just have them move really quickly past the screen, and then have them roll for a bit more once the user clicks the button) |
Author: | Raknarg [ Tue Jun 05, 2012 8:17 pm ] |
Post subject: | RE:Final Project Time! |
The interesting thing about images is that they're integers, so you can just create an array of integers and assign pictures to them. Have you ever tried working with pictures before? |
Author: | brownni [ Wed Jun 06, 2012 12:24 pm ] |
Post subject: | Re: Final Project Time! |
I have worked with arrays but loading in images in the spot of integers i am competely lost. And thanks for the quick replys guys ![]() |
Author: | Raknarg [ Wed Jun 06, 2012 12:46 pm ] |
Post subject: | RE:Final Project Time! |
http://compsci.ca/v3/viewtopic.php?t=191 |
Author: | brownni [ Wed Jun 06, 2012 1:05 pm ] |
Post subject: | Re: Final Project Time! |
I have not taken a look at that link yet but, I was thinking what if i made a string array. and within the string array it was the name of the picture files, so that when it gets pulled out i can then set a new image icon to the index and it would point to that image.... if you understand what i am saying ?? Example ---------- lblWhatEver[5].setIcon(new imageIcon(picArray[index]); ??? soo. The label is out of an array of 5, and which ever string gets picked than set that name to the pic that i want> |
Author: | brownni [ Wed Jun 06, 2012 1:06 pm ] |
Post subject: | Re: Final Project Time! |
OH MY IM SORRY!! I JUST REALIZED I DIDNT SAY IT WAS JAVA ![]() ![]() |
Author: | mirhagk [ Wed Jun 06, 2012 2:24 pm ] | ||||
Post subject: | RE:Final Project Time! | ||||
no that's actually @Raknarg's fault. This is the Java section, we should assume it's java. You can do a similar thing in java though, just have an array of imageIcon's. My Java is rusty but I believe it'd be like:
assuming ImageIcon is the class your using and arraySize is the number of pictures there are. Then do something like:
assuming your files are called icon1.png,icon2.png etc |
Author: | bl0ckeduser [ Wed Jun 06, 2012 6:34 pm ] |
Post subject: | Re: RE:Final Project Time! |
Raknarg @ Tue Jun 05, 2012 8:17 pm wrote: The interesting thing about images is that they're integers
Indeed interesting. Using this, everything and anything is an integer: http://en.wikipedia.org/wiki/Godel_numbering EDIT: forum doesn't like unicode so I edited the article URL accordingly |
Author: | Raknarg [ Wed Jun 06, 2012 7:45 pm ] |
Post subject: | RE:Final Project Time! |
Oh, sorry, I didnt look at the post section, I was getting caught up with a lot of turing posts... @bl0ckeduser no need to be a smartass |
Author: | bl0ckeduser [ Thu Jun 07, 2012 10:36 pm ] |
Post subject: | Re: RE:Final Project Time! |
Raknarg @ Wed Jun 06, 2012 7:45 pm wrote: @bl0ckeduser no need to be a smartass Sorry about that. I guess the Internet already has too many of these, eh. There are some irc channels and newsgroups I know of that always tend to get pedantic / debate over semantics for no reason. ![]() I do think Godel numbering is an interesting subject though. |
Author: | Raknarg [ Fri Jun 08, 2012 9:56 am ] |
Post subject: | RE:Final Project Time! |
It actually is ![]() |
Author: | brownni [ Wed Jun 20, 2012 3:52 pm ] |
Post subject: | RE:Final Project Time! |
Well guys and gals I am finally done, and I shall post it after I hand it in! Thanks for the help!! |