Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 displaying objects in arrays
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
diablo




PostPosted: Tue Nov 09, 2004 10:21 am   Post subject: displaying objects in arrays

1)i have an RPG game in the works,
but i don't know how to tell the program to display what is in the inventory array.
can you tell me?

2)also can you tell me, when i use "itemX" from inventory slot 1,how so that when i display the inventory again, slot 1 will be empty and i can buy in item to fill it up again.
so that when i buy "itemY" will fill up the next available slot.?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Nov 09, 2004 10:30 am   Post subject: (No subject)

run a forloop, 1 to inventory size, and display each element
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
diablo




PostPosted: Tue Nov 09, 2004 10:34 am   Post subject: (No subject)

so if i have and inventory of 20 items(ex:slot 1=itemX, slot2=itemY,etc)
i have to run a FOR loop for each element?
Tony




PostPosted: Tue Nov 09, 2004 10:41 am   Post subject: (No subject)

no
code:

for slotID: 1..20
     display(item(slotID))
end for


where display is a function that atually does the displaying (whatever you code... like draw or something
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: