displaying objects in arrays
Author |
Message |
diablo
|
Posted: 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.? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Tue Nov 09, 2004 10:30 am Post subject: (No subject) |
|
|
run a forloop, 1 to inventory size, and display each element |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
diablo
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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 |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|