View Single Post
  #7  
Old 10-18-2011, 07:36 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
You make things so much simpler.
All I have to do now is add the images of random trash and presto.
Would you possible know how to put names and images in an array?
maybe something like.
PHP Code:
temp.trash = {
  {
"trashone.png", Name},
  {
"trashtwo.png", Name}
}; 
I believe this is how a "3D" array works?
But how would you read the information from that and pick a random trash object O_O
PHP Code:
this.chosen = random(0, temp.trash.size()); 
Yet again im probably horribly wrong.
I was just thinking doing an array would make it look much nicer and be easier to add more items, rather than doing this.
PHP Code:
temp.chosen = random(1, 3);
if (
temp.chosen == "1") {
  
this.item = "Garbage 1";
  
this.image = "Image for it";
}
if (
temp.chosen == "2") {
  
this.item = "Garbage 2";
  
this.image = "Image for it";
}
if (
temp.chosen == "3") {
  
this.item = "Garbage 3";
  
this.image = "Image for it";
} 
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote