Computer Science Canada

displaying objects in arrays

Author:  diablo [ 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.?

Author:  Tony [ Tue Nov 09, 2004 10:30 am ]
Post subject: 

run a forloop, 1 to inventory size, and display each element

Author:  diablo [ Tue Nov 09, 2004 10:34 am ]
Post 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?

Author:  Tony [ Tue Nov 09, 2004 10:41 am ]
Post 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


: