0 Members and 1 Guest are viewing this topic.
.the sprite[FF00FF00FF00FF00] -> GDB0 .only do the -> GDB0 in the first item[00] .type of item[Str000] .pointer to the string containing the name of the item[Str001] .pointer to string containing the description.repeat for other items
.Here we'll make the inventory ready to usefor(T,0,23)0->{T+L1}End.this made the inventory empty, so we won't end up with random items when the game starts
.Now we add an item,of which the ID is stored in A, to the inventory0->Twhile(T<24)if({T+L1}=0A -> {T+L1}0->A24->TEndT++End.I made it so that when the item could be placed in the inventory, A is set to 0. If it couldn't store it becouse the inventory was full, A would still have the original value.
.What can also be useful is checking if the inventory contains an item. The ID of the item should be stored to A0->TWhile(T<24)if({T+L1}=A)....remove those 3 dots and those below the code if you want to delete the item when it's found0->{T+L1}...0->A24->TEndT++End.A will be 0 when the item was found and will still contian it's original value when it couldn't find the item.
.Unless your game is entirely text-based, a way to draw the inventory is also usefulFor(T,0,5)For(U,0,3)If(4*T+U) .If there is an item herePt_On(U*8+X,T*8+Y,4*T+U*13+L1) .you can use any sprite drawing routine you wantEndEndEnd.Guess what X and Y are.Correct: They are the X and Y coordinates on which the inventory should be drawn.
Thanks. I don't really understand the drawing part though. What is the Ux13 for?
.INVNTRY"SWORD"->Str00"10 DAMAGE"->Str10"POTION"->Str01"+20 HP"->Str11"PEAR"->Str02"+20 MP"->Str12[03050A94E870F0D8]->GDB0[01][Str00][Str10][181824244242423C][00][Str01][Str11][0C1028284482827C][00][Str02][Str12]For(T,0,23)1ü{T+L‚}EndRepeat getKey(15)sub(DRAWDispGraEndLbl ADD0->r6While (r6<24)!If {r6+L2}r1->{r6+L2}24->TEndT++EndReturnLbl DRAWFor(T,0,5)For(U,0,3)If ({4*T+U+L2})Pt-On(U*8,T*8,(4*T+U+{L2})*13-13+GDB0EndEndEndReturn
I understand how to do the picture inventory now, but it doesn't really suit my game. How would you create an inventory that just showed the names of items and scrolled, and when an item is selected, it shows more info? Also, how can you create a maximum unique item count?