Hi Leute
Ich bin gerade dabei ein TikTakToe-Spiel zu programmieren...
Ich hab das Problem das wenn ich das spiel starte die maus und das feld super angezeigt werden ... bloß wird nix gemalt wenn ich auf eines der Felder klicke...ist bestimmt ein ziemlicher anföngerfehler aber ich find ihn einfach nicht
Im nachfolgenden mein Code ...
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN] Graphics 640, 480, 16, 0 AppTitle "Tik tak toe "
SetBuffer BackBuffer()
SeedRnd MilliSecs() ClsColor 255, 0, 255 HidePointer
Global hintergrund=LoadImage("hintergrund.bmp") Global kreis=LoadImage("kreis.bmp") Global kreuz=LoadImage("kreuz.bmp") Global zeiger=LoadImage("maus.bmp")
MaskImage hintergrund, 255, 0, 255 MaskImage kreis, 255, 0 ,225 MaskImage kreuz, 255, 0, 255 MaskImage zeiger, 255, 0, 255
Global lox=0 Global loy=0
Global mox=215 Global moy=0
Global rox=430 Global roy=0
Global lmx=0 Global lmy=165
Global mmx=217 Global mmy=163
Global rmx=430 Global rmy=162
Global lux=0 Global luy=322
Global mux=217 Global muy=322
Global rux=429 Global ruy=322
font=LoadFont ("arial", 16, True, True) SetFont font
Global zug=1
While Not KeyDown(1) Cls
abfrage() malescreen() maus()
Flip Wend End
Function malescreen() DrawImage hintergrund, hx, hy If zug=1
If linksoben = 0 And abfrage=True Then DrawImage kreis, lox, loy And linksoben=1 If mitteoben = 0 And abfrage=True Then DrawImage kreis, mox, moy And mitteoben=1 If rechtsoben = 0 And abfrage=True Then DrawImage kreis, rox, roy And rechtsoben=1 If linksmitte = 0 And abfrage=True Then DrawImage kreis, lmx, lmy And linksmitte=1 If mittemitte = 0 And abfrage=True Then DrawImage kreis, mmx, mmy And mittemitte=1 If rechtsmitte = 0 And abfrage=True Then DrawImage kreis, rmx, rmy And rechtsmitte=1 If limksunten = 0 And abfrage=True Then DrawImage kreis, lux, luy And linksunten=1 If mitteunten = 0 And abfrage=True Then DrawImage kreis, mux, muy And mitteunten=1 If rechtsunten = 0 And abfrage=True Then DrawImage kreis, rux, ruy And rechtsunten=1 EndIf
If zug=2
If linksoben = 0 And abfragelo =True Then DrawImage kreuz, lox, loy And linksoben=2 If mitteoben = 0 And abfragemo =True Then DrawImage kreuz, mox, moy And mitteoben=2 If rechtsoben = 0 And abfragero =True Then DrawImage kreuz, rox, roy And rechtsoben=2 If linksmitte = 0 And abfragelm =True Then DrawImage kreuz, lmx, lmy And linksmitte=2 If mittemitte = 0 And abfragemm =True Then DrawImage kreuz, mmx, mmy And mittemitte=2 If rechtsmitte = 0 And abfragerm =True Then DrawImage kreuz, rmx, rmy And rechtsmitte=2 If limksunten = 0 And abfragelu =True Then DrawImage kreuz, lux, luy And linksunten=2 If mitteunten = 0 And abfragemu =True Then DrawImage kreuz, mux, muy And mitteunten=2 If rechtsunten = 0 And abfrageru =True Then DrawImage kreuz, rux, ruy And rechtsunten=2 EndIf
End Function
Function maus() DrawImage zeiger, MouseX(), MouseY()
End Function
Function abfrage()
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 0, 0, 213, 160) Then abfregelo=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 215, 0, 213, 160) Then abfregemo=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 430, 0, 213, 160) Then abfregero=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 0, 165, 213, 160) Then abfregelm=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 217, 163, 213, 160) Then abfregemm=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 430, 162, 213, 160) Then abfregerm=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 0, 322, 213, 160) Then abfregelu=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 217, 322, 213, 160) Then abfregemu=True
If MouseDown(1) And ImageRectCollide(zeiger, MouseX(), MouseY(), 0, 429, 322, 213, 160) Then abfregeru=True
End Function
|