Itemmenü mit Kollisions abfrage

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

lohgock

Betreff: Itemmenü mit Kollisions abfrage

BeitragSo, Nov 06, 2005 13:50
Antworten mit Zitat
Benutzer-Profile anzeigen
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]
Function itemfunk()
Flip
FlushKeys
;SCHLEIFE
Repeat
x = MouseX()
y = MouseY()
Cls
;ZEICHNEN DER KÄSTCHEN
For i =1 To 5
For j =1 To 4
Rect 100*i,100*j,100,100,0

Next
Next
;ZEICHNEN DER KÄSTCHEN FÜR EQUIP
Rect 650,100,100,100,0
Rect 750,100,100,100,0
;ZEICHNEN DER BILDER FÜR EQUIP
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
;ANZEIGEN DER NAMEN DER ITEMS UDN MENGE
Text 105+a,105+b,itemname$(itempl(h,1),1)
Text 180+a,180+b,itempl(h,2)

;ZEICHNEN DER BILDER

If itempl(h,1) <> 0 Then
DrawImage itembild(itempl(h,1)),itempl(h,4),itempl(h,5)
;KOLLISIONS ABFRAGE
EndIf
;ZEICHEN DRECK
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
;MONSTER DATEI EINLESEN
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)
;SCHAUN OBS EIN QUESTITEM IST
If questitem = 0 Then
;SCHAUT WAS ES GIBT
Select dazu
Case 1
;HP
PlaySound sfxsound(8)
hp = hp+wieviel
If hp > maxhp Then hp = maxhp
Case 2
;MP
PlaySound sfxsound(8)
mp = mp+wieviel
If mp > maxmp Then mp = maxmp
Case 3
;STÄRKE
St = st+wieviel
;TYP (LINKE HAND REHCTE HAND)
If typ = 1 Then
;WÄHLÖT WAS ES IST
Select itempl(1,1)
Case 3
;SCHWERT
loadplayer(\"swordstan\")
Case 4
;STAFF
loadplayer(\"staffstan\")
Case 5
;AXE
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
;ITEM MENGE -! MACHEN
itempl(i,2) =itempl(i,2) -1
;WENN MENGE = 0 DANN ITEM =0
If itempl(i,2) = 0 Then itempl(i,1) = 0
EndIf
EndIf
.klo
Next

;POINTER
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!

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group