Hi,
ich bin gard daran ein RPG zu programmieren.
Ich hab schon : Maps,quets,item,warps,events...
nur beid en items hab ich ein fettes problem.
ich hab ne funktion und dort werden 20 items aufgelistet
und wenn der spieler ein item anklcikt soll das passieren was ich in der item datei gespeicherthabe!
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Function itemfunk() Flip FlushKeys Repeat x = MouseX() y = MouseY() Cls For i =1 To 5 For j =1 To 4 Rect 100*i,100*j,100,100,0 Next Next Rect 650,100,100,100,0 Rect 750,100,100,100,0 If hand(1,1) <> 0 Then DrawImage itembild(hand(1,1)),665,115 Text 665,155,itemname$(hand(1,1),1) EndIf For h = 1 To 20 Text 105+a,105+b,itemname$(itempl(h,1),1) Text 180+a,180+b,itempl(h,2)
If itempl(h,1) <> 0 Then DrawImage itembild(itempl(h,1)),itempl(h,4),itempl(h,5) EndIf If d = 0 Then a = a+100 If a = 500 Then d = 1 a = 0 EndIf EndIf If d = 1 Then b = b +100 d = 0 If b = 400 Then b = 0 EndIf EndIf Next
For i = 1 To 20 If itembild(itempl(i,1)) = 0 Then Goto klo If ImageRectCollide(itembild(itempl(i,1)),itempl(i,4),itempl(i,5),0,X,Y,2,2) And MouseHit(1) Then End itemsdatei =OpenFile(\"database/items/\"+itempl(i,1)+\".ini\") ReadLine(itemsdatei) ReadLine(itemsdatei) dazu = ReadLine(itemsdatei) wieviel = ReadLine(itemsdatei) questitem = ReadLine(itemsdatei) ReadLine(itemsdatei) typ = ReadLine(itemsdatei) If questitem = 0 Then Select dazu Case 1 PlaySound sfxsound(8) hp = hp+wieviel If hp > maxhp Then hp = maxhp Case 2 PlaySound sfxsound(8) mp = mp+wieviel If mp > maxmp Then mp = maxmp Case 3 St = st+wieviel If typ = 1 Then Select itempl(1,1) Case 3 loadplayer(\"swordstan\") Case 4 loadplayer(\"staffstan\") Case 5 loadplayer(\"axestan\") End Select Select hand(1,1) Case 0 hand(1,1) = itempl(i,1) Default For l = 1 To 20 If itempl(l,1) = 0 Then itempl(l,1) = hand(1,1) itempl(l,2) = 1 Goto itemzurck EndIf Next .itemzurck hand(1,1)= itempl(i,1) End Select EndIf End Select itempl(i,2) =itempl(i,2) -1 If itempl(i,2) = 0 Then itempl(i,1) = 0 EndIf EndIf .klo Next DrawImage pointer,MouseX(),MouseY() Flip Until KeyHit(60) FlushKeys End Function
sry für meien code weiße aber ich kennmcih imemrnoch aus. Die kommentare hab ich jetzt extrahinzu gemacht
Also wenn ich rum lauf und dann die items auf heb und dann ins item menü geh überprüft der nur das erste item! Wieso?
Bei fragen zum Code einfach fragen!
|