Inventar
Übersicht BlitzBasic Allgemein
PhilosBetreff: Inventar |
Mi, Dez 03, 2008 23:11 Antworten mit Zitat |
|
---|---|---|
Liebe Forum-Gemeinde,
Ich habe folgenden Code: Code: [AUSKLAPPEN] For x=0 To 4
DrawImage raster,x*64+15,257 If mldown=0 Then For it.item=Each item If pickitemstat<>0 And mx>(x*64+15)+fensterx And mx<(x*64+15+64)+fensterx And my>257+fenstery And my<(257+64)+fenstery And pickedup1stat=0 And x=0 Then pickedup1stat=1 pickedup1=pickitem If pickitem=it.item\Bild Then it.item\Anzahl=it.item\anzahl-1 EndIf If pickitemstat<>0 And mx>x*64+15+fensterx And mx<x*64+15+64+fensterx And my>257+fenstery And my<257+64+fenstery And pickedup2stat=0 And x=1 Then pickedup2stat=1 pickedup2=pickitem If pickitem=it.item\Bild Then it.item\Anzahl=it.item\anzahl-1 EndIf If pickitemstat<>0 And mx>x*64+15+fensterx And mx<x*64+15+64+fensterx And my>257+fenstery And my<257+64+fenstery And pickedup3stat=0 And x=2 Then pickedup3stat=1 pickedup3=pickitem If pickitem=it.item\Bild Then it.item\Anzahl=it.item\anzahl-1 EndIf If pickitemstat<>0 And mx>x*64+15+fensterx And mx<x*64+15+64+fensterx And my>257+fenstery And my<257+64+fenstery And pickedup4stat=0 And x=3 Then pickedup4stat=1 pickedup4=pickitem If pickitem=it.item\Bild Then it\Anzahl=it\anzahl-1 EndIf If pickitemstat<>0 And mx>x*64+15+fensterx And mx<x*64+15+64+fensterx And my>257+fenstery And my<257+64+fenstery And pickedup5stat=0 And x=4 Then pickedup5stat=1 pickedup5=pickitem If pickitem=it.item\Bild Then it\Anzahl=it\anzahl-1 EndIf Next EndIf If x=0 And pickedup1stat=1 Then DrawImage pickedup1,x*64+15,257 If x=1 And pickedup2stat=1 Then DrawImage pickedup2,x*64+15,257 Dieser Befehl beschreibt 5 "Artefakt-Slots" man kann ein Artefakte in diese Slots stecken, solgange der Slot frei ist. Mein Problem ist folgendes: Ich möchte die Anzahl (it.item\Anzahl) dann verringern, wenn man dieses Item in den Slot steckt. Ich habe 3 versch. Artefakte. aber es verringert sich immer nur die Anzahl des 1 Artefakts. Kann mir bitte jemand helfen? Ich habe zwar schon zig mal einen Freund genervt, der mir versuchte, was zu erklären, doch da ich mit Types bisher wenig Erfahrung habe, ist das nicht so einfach... Also Danke im Voraus, MfG Philos |
||
Männer aus Stahl fahren Autos aus Pappe |
XeresModerator |
Do, Dez 04, 2008 1:27 Antworten mit Zitat |
|
---|---|---|
Ich sehe da nicht durch.
Eine genauere Beschreibung was du erreichen möchtest (Kommentare im Code...) und/oder eine skizze wären hilfreich. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
Philos |
Fr, Dez 05, 2008 21:33 Antworten mit Zitat |
|
---|---|---|
Ich glaube, der Code ist gar nicht mal so wichtig. Mein Problem ist nämlich eigentlich ganz einfach.
Ich habe Type Item und das Feld Anzahl. Ich habe jetzt drei verschiedene Sorten von Items -> it.item. und wenn ich jetzt ein Artefakt in einen Slot packen möchte, soll natürlich sich die Anzahl des aktuellen Items verringern,sodass man nicht 1 item in alle 5 Slots steckt. Man brauch also 5 Items. Bloss wie prüfe ich, welches Item benutzt wird, und dass sich genau die Zahl des z.B. grünen Artefakts verringert? |
||
Männer aus Stahl fahren Autos aus Pappe |
XeresModerator |
Fr, Dez 05, 2008 23:04 Antworten mit Zitat |
|
---|---|---|
Jeder Slot hat einen Inhalt vom Typ item, ist keins darin ist der Inhalt=Null. Am besten ginge das mit einem Slot-Type...
Etwa so: Code: [AUSKLAPPEN] Type Titem
Field Farbe$ Field Anzahl End Type Type Tslot Field Inhalt.Titem End Type Local Slot.Tslot = New Tslot PrintInhalt(Slot) Local item.Titem = New Titem item\Farbe="Rot" item\Anzahl=3 PutInSlot(item, Slot) Print "Übrige Rote Items:"+item\Anzahl PrintInhalt(Slot) WaitKey() End Function PutInSlot(i.Titem, s.Tslot) If s\Inhalt = Null Then s\Inhalt = i i\Anzahl = i\Anzahl -1 EndIf End Function Function PrintInhalt(s.Tslot) If s\Inhalt = Null Then Print "Der Slot ist Leer" Else Print "Im Slot ist ein "+s\Inhalt\Farbe+"es item." EndIf End Function |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
Philos |
Sa, Dez 06, 2008 19:32 Antworten mit Zitat |
|
---|---|---|
Ah ja es klappt, Danke Habs aber noch n bisl anders gemacht, da mir jez ein Freund das Inventar geschickt hat. Ich schreib das noch ein bisschen um. Aber trotzdem Danke für die schnelle Antwort ! =) | ||
Männer aus Stahl fahren Autos aus Pappe |
Übersicht BlitzBasic Allgemein
Powered by phpBB © 2001 - 2006, phpBB Group