Buttons mit einer function gemacht geht aber nur einer(DONE)
Übersicht

![]() |
Schranz0rBetreff: Buttons mit einer function gemacht geht aber nur einer(DONE) |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi Leute
Ich finde den fehler nicht, wieso nur der eine Button geht. Die collision bei den Rects stimmt, aber es funzt einfach net: die RAR : HIER Code: [AUSKLAPPEN] Graphics 800,600,0,2 SetBuffer BackBuffer() HidePointer Maus = LoadImage("maus.bmp") Global Wahl = 0 Repeat Cls Mx=MouseX() My=MouseY() Button(100,100,100,20,"Start",58,58,58,255,255,255,0,1) Button(200,100,100,20,"Beenden",58,58,58,255,255,255,0,2) If RectsOverlap(Mx,My,1,1,100,100,100,20) Then Wahl = 1 If RectsOverlap(Mx,My,1,1,200,100,100,20) Then Wahl = 2 : Text 300,300,"GEHT!!!" ;------------------Maus Zeichen----------------------------------- Color 0,0,0 Rect Mx,My,1,1,1 DrawImage Maus,Mx,My ;----------------------------------------------------------------- Color 255,255,255 Text 20,20,"Wahl : "+ Wahl Flip Until KeyHit(1) Function Button(Bx,By,weite,hoehe,Txt$,Rot,Gruen,Blau,Rot2,Gruen2,Blau2,Defaultnummer,Wahln) If Wahl = Wahln then Color Rot,Gruen,Blau Rect Bx,By,weite,hoehe,1 Color 120,120,120 Line Bx,By,Bx+weite,By Line Bx,By+1,Bx+weite,By+1 Line Bx+1,By+hoehe,Bx+1,By Line Bx,By+hoehe,Bx,By Color 255,255,255 Line Bx,By+hoehe,Bx+weite,By+hoehe Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1 Line Bx+weite,By,Bx+weite,By+hoehe Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2 Else Color Rot,Gruen,Blau Rect Bx,By,weite,hoehe,1 Color 255,255,255 Line Bx,By,Bx+weite,By Line Bx,By+1,Bx+weite,By+1 Line Bx+1,By+hoehe,Bx+1,By Line Bx,By+hoehe,Bx,By Color 120,120,120 Line Bx,By+hoehe,Bx+weite,By+hoehe Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1 Line Bx+weite,By,Bx+weite,By+hoehe Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2 EndIf If Not RectsOverlap(Mx,My,1,1,Bx,By,weite,hoehe) Then Wahl = 0 Color Rot2,Gruen2,Blau2 Text Bx+(weite/2),By+(hoehe/2),Txt$,1,1 End Function die Defaultnummer ist schrott, brauch nichnet mehr ![]() Hab ich grad mal so gesehen ![]() |
||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!HAUPTSACH et kost VIEL!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
- Zuletzt bearbeitet von Schranz0r am Sa, Sep 09, 2006 13:17, insgesamt einmal bearbeitet
![]() |
DerHase |
![]() Antworten mit Zitat ![]() |
---|---|---|
Es geht nicht weil die Button Funktion am Ende den Wert auf 0 setzt. Also bei der Abfrage für den ersten Button, so kann Wahl gar nicht 2 werden.
Aber man kann es ja ganz geschickt vertauschen: Code: [AUSKLAPPEN] Graphics 800,600,0,2
SetBuffer BackBuffer() ;HidePointer ;Maus = LoadImage("maus.bmp") Global Wahl = 0 Repeat Cls Mx=MouseX() My=MouseY() If RectsOverlap(Mx,My,1,1,100,100,100,20) Then Wahl = 1 Button(100,100,100,20,"Start",58,58,58,255,255,255,0,1) If RectsOverlap(Mx,My,1,1,200,100,100,20) Then Wahl = 2 : Text 300,300,"GEHT!!!" Button(200,100,100,20,"Beenden",58,58,58,255,255,255,0,2) ;------------------Maus Zeichen----------------------------------- Color 0,0,0 Rect Mx,My,1,1,1 ;DrawImage Maus,Mx,My ;----------------------------------------------------------------- Color 255,255,255 Text 20,20,"Wahl : "+ Wahl Flip Until KeyHit(1) Function Button(Bx,By,weite,hoehe,Txt$,Rot,Gruen,Blau,Rot2,Gruen2,Blau2,Defaultnummer,Wahln) If Wahl = Wahln Then Color Rot,Gruen,Blau Rect Bx,By,weite,hoehe,1 Color 120,120,120 Line Bx,By,Bx+weite,By Line Bx,By+1,Bx+weite,By+1 Line Bx+1,By+hoehe,Bx+1,By Line Bx,By+hoehe,Bx,By Color 255,255,255 Line Bx,By+hoehe,Bx+weite,By+hoehe Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1 Line Bx+weite,By,Bx+weite,By+hoehe Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2 Else Color Rot,Gruen,Blau Rect Bx,By,weite,hoehe,1 Color 255,255,255 Line Bx,By,Bx+weite,By Line Bx,By+1,Bx+weite,By+1 Line Bx+1,By+hoehe,Bx+1,By Line Bx,By+hoehe,Bx,By Color 120,120,120 Line Bx,By+hoehe,Bx+weite,By+hoehe Line Bx,By+hoehe-1,Bx+weite,By+hoehe-1 Line Bx+weite,By,Bx+weite,By+hoehe Line Bx+weite-1,By+2,Bx+weite-1,By+hoehe-2 EndIf If Not RectsOverlap(Mx,My,1,1,Bx,By,weite,hoehe) Then Wahl = 0 Color Rot2,Gruen2,Blau2 Text Bx+(weite/2),By+(hoehe/2),Txt$,1,1 End Function Btw, bau doch diese Rectoverlapabfrage gleich in den Anfang der Funktion. |
||
![]() |
Schranz0r |
![]() Antworten mit Zitat ![]() |
---|---|---|
Dank dir Hase, hast mir den Tag gerettet ![]() Hast was gut bei mir. PROBLEM GELÖST BY: DerHase |
||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!HAUPTSACH et kost VIEL!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group