Riesen Problem
Übersicht

Silernthunt4rBetreff: Riesen Problem |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Ich hab hier ein Quelltext die obere hälfte ist der Server und ich weiß nicht warum es mir den Stream nur ein mal schickt
Code: [AUSKLAPPEN] Graphics 1024,768,16,0 SetBuffer BackBuffer () ;inports__________________________________________________ higru= LoadImage("Strand.png" ) Spieler1= LoadImage ("Spieler1.png") Spieler2=LoadImage ("Spieler2.png") Ball = LoadImage ("Ball.png") Arial = LoadFont (arial,30) Ballfont = LoadFont ( Arial,100 ) ;Variablen________________________________________________ Spieler= 1 p1_y =400 p2_y =400 rotation=0 rota = 4 Richtung = Rnd (0,1) b_x= 500 b_y= 350 Winkel = Rnd (-10,10) Geschwindigkeit =8 Punkte_S1 =0 Punkte_S2 =0 namegeg$ = "Gegner" Local NewClient, ClientStream ;Online___________________________________________________ Local Stream = CreateTCPServer( 4600 ) .spielerda ;_____________________________________________________________ If Richtung =0 Then Geschwindigkeit =-8 HidePointer ms = MilliSecs () nc=0 Repeat .ohgott NewClient = AcceptTCPStream( Stream ) If newclient Then nc = nc+1 If nc =0 ;SetFont Arial DrawImage higru,0,0 Text 300,300, "Warte auf Spieler" Flip Goto ohgott EndIf ;_____________________________________________________________ While ReadAvail( NewClient) test= ReadInt( NewClient) .nix If test <> 0 Then p2_y=test Text 300,300, p2_y Sendstring$ = bx + "."+by+"."+p1_y Wend ;WriteLine NewClient, Sendstring$ ;_____________________________________________________________ Color r,g,b SetFont Arial Cls DrawImage higru,0,0 DrawImage Spieler1 ,40,p1_y DrawImage Spieler2 ,930,p2_y DrawImage Ball ,b_x,b_y MidHandle Ball ;RotateImage Ball,10 rottion = rotation +rota b_x = b_x + Geschwindigkeit b_y= b_y + Winkel If ImagesCollide (Spieler1,40,p1_y,0,Ball,b_x,b_y,0) Geschwindigkeit = Geschwindigkeit *-1 Winkel = Rnd (-10,10) rota =rota*-1 EndIf If ImagesCollide (Spieler2,930,p2_y,0,Ball,b_x,b_y,0) Geschwindigkeit = Geschwindigkeit *-1 Winkel = Rnd (-10,10) rota =rota*-1 EndIf If b_y <=0 Or b_y>=700 Then Winkel = Winkel*-1 Text 10,10,name$+": "+Punkte_S1+" Punkte" Text 850,10,namegeg$+": "+Punkte_S2+" Punkte" Text 500,10,MilliSecs () - ms If MilliSecs()>= ms +60000 Then Goto sieg ;If rotation >=360 Or rotation<= -360 Then rotation =0 If KeyDown (200) Then p1_y = p1_y -6 If KeyDown (208) Then p1_y = p1_y +6 If b_x <= 0 Punkte_S2 =Punkte_S2+1 SetFont Ballfont b_x =500 b_y = 350 Richtung = Rnd (0,1) Winkel = Rnd (-10,10) ballsperre = MilliSecs () Repeat If MilliSecs() >= ballsperre + 1000 And MilliSecs() <= ballsperre + 1800 Then Text 500,200,"3" If MilliSecs() >= ballsperre + 2000 And MilliSecs() <= ballsperre + 2800 Then Text 500,300,"2" If MilliSecs() >= ballsperre + 3000 And MilliSecs() <= ballsperre + 3800 Then Text 500,400,"1" If MilliSecs() >= ballsperre + 4000 And MilliSecs() <= ballsperre + 4800 Then Text 500,500,"Los" Flip Until MilliSecs() >= ballsperre + 4000 EndIf If b_x >= 1000 SetFont Ballfont Punkte_S1 =Punkte_S1+1 b_x =500 b_y = 350 Richtung = Rnd (0,1) Winkel = Rnd (-10,10) ballsperre = MilliSecs () Repeat If MilliSecs() >= ballsperre + 1000 And MilliSecs() <= ballsperre + 1800 Then Text 500,200,"3" If MilliSecs() >= ballsperre + 2000 And MilliSecs() <= ballsperre + 2800 Then Text 500,300,"2" If MilliSecs() >= ballsperre + 3000 And MilliSecs() <= ballsperre + 3800 Then Text 500,400,"1" If MilliSecs() >= ballsperre + 4000 And MilliSecs() <= ballsperre + 4800 Then Text 500,500,"Los" Flip Until MilliSecs() >= ballsperre + 4000 EndIf If p1_y<=0 Then p1_y= 0 If p1_y>=430 Then p1_y= 430 If zaehler =70 r =Rnd (0,255) g =Rnd (0,255) b =Rnd (0,255) zaehler =0 EndIf zaehler = zaehler +1 Flip Forever .sieg If Punkte_S1 = Punkte_S2 Then Text 400,200,"UNENTSCHIEDEN" If Punkte_S1 > Punkte_S2 Then Text 400,200,name$ + " gewinnt" If Punkte_S1 < Punkte_S2 Then Text 400,200,namegeg$+" gewinnt" Flip Select DLLMessageBox("Noch mal spielen?", "Möchten sie noch einmal spielen?", MB_ICONQUESTION Or MB_YESNO) Case IDYES Goto spielerstellen Case IDNO Goto start End Select End ;:::::::::::::::::::::::::::::::::::::::::::::::: ;_________________________________________________ ;:::::::::::::::::::::::::::::::::::::::::::::::: .beitreten Graphics 440,20,16,0 AppTitle "Host IP" ClsColor 255,255,255 Cls Color 0,0,0 IP$= Input ("Bitte geben sie die IP des Hosts an:") Spieler= 1 p1_y =400 p2_y =400 rotation=0 rota = 4 b_x= 500 b_y= 350 Punkte_S1 =0 Punkte_S2 =0 namegeg$ = "Gegner" Graphics 1024,768,16,0 AppTitle ( "BeachPong v1.0 (c) Julian Eble 2010" ) higru= LoadImage("Strand.png" ) Spieler1= LoadImage ("Spieler1.png") Spieler2=LoadImage ("Spieler2.png") Ball = LoadImage ("Ball.png") Arial = LoadFont (arial,30) Ballfont = LoadFont ( Arial,100 ) HidePointer ms = MilliSecs () Local Streamin = OpenTCPStream( "127.0.0.1", 4600) If Not Streamin Then RuntimeError "Verbindung konnte nicht hergestellt werden." Repeat Color r,g,b SetFont arial Cls DrawImage higru,0,0 DrawImage Spieler1 ,40,p1_y DrawImage Spieler2 ,930,p2_y DrawImage Ball ,b_x,b_y MidHandle Ball ;RotateImage Ball,10 rottion = rotation +rota Text 10,10,name$+": "+Punkte_S1+" Punkte" Text 850,10,namegeg$+": "+Punkte_S2+" Punkte" Text 500,10,MilliSecs () - ms If MilliSecs()>= ms +60000 Then Goto siegen ;If rotation >=360 Or rotation<= -360 Then rotation =0 If KeyDown (200) Then p2_y = p2_y -6 If KeyDown (208) Then p2_y = p2_y +6 If b_x <= 0 Punkte_S2 =Punkte_S2+1 SetFont Ballfont ballsperre = MilliSecs () Repeat If MilliSecs() >= ballsperre + 1000 And MilliSecs() <= ballsperre + 1800 Then Text 500,200,"3" If MilliSecs() >= ballsperre + 2000 And MilliSecs() <= ballsperre + 2800 Then Text 500,300,"2" If MilliSecs() >= ballsperre + 3000 And MilliSecs() <= ballsperre + 3800 Then Text 500,400,"1" If MilliSecs() >= ballsperre + 4000 And MilliSecs() <= ballsperre + 4800 Then Text 500,500,"Los" Flip Until MilliSecs() >= ballsperre + 4000 EndIf If b_x >= 1000 SetFont Ballfont Punkte_S1 =Punkte_S1+1 ballsperre = MilliSecs () Repeat If MilliSecs() >= ballsperre + 1000 And MilliSecs() <= ballsperre + 1800 Then Text 500,200,"3" If MilliSecs() >= ballsperre + 2000 And MilliSecs() <= ballsperre + 2800 Then Text 500,300,"2" If MilliSecs() >= ballsperre + 3000 And MilliSecs() <= ballsperre + 3800 Then Text 500,400,"1" If MilliSecs() >= ballsperre + 4000 And MilliSecs() <= ballsperre + 4800 Then Text 500,500,"Los" Flip Until MilliSecs() >= ballsperre + 4000 EndIf If p2_y<=0 Then p2_y= 0 If p2_y>=430 Then p2_y= 430 If zaehler =70 r =Rnd (0,255) g =Rnd (0,255) b =Rnd (0,255) zaehler =0 EndIf zaehler = zaehler +1 While ReadAvail( Streamin ) InString$=ReadLine( Streamin) WriteInt Streamin, p2_y Wend Flip Forever ps. ist viel code aber die Befehle sinfd leider verteilt |
||
![]() |
Goodjee |
![]() Antworten mit Zitat ![]() |
---|---|---|
wenn sowas nicht läuft, schreib dir ein testprogramm was nur daten verschickt über tcp...wenn du das nich zum laufen kriegst kannse uns den gesamten code vorklatschen.
ich persönlich finde deinen riesencode unzumutbar, nicht nur wegen den fehlenden tabs |
||
"Ideen sind keine Coladosen, man kann sie nicht recyclen"-Dr. House
http://deeebian.redio.de/ http://goodjee.redio.de/ |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
...und mit GoTo ist der Quelltext noch weniger zu durchschauen.
Code: [AUSKLAPPEN] .ohgott Sagt schon alles ![]() Edit: Mit dem Titel "Riesen Problem" landet das hier sicherlich im Trash... |
||
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) |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Im Trash nicht, es ist ja die Beginners Corner, aber ich denke es wird dir bei so genauen Beschreibungen niemand helfen (wollen). | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
Silernthunt4r |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Also... mein Problem ist das ich in meinem Testprogramm datenpakete ungehindert verschicjen konnte und im Richtigen Programm funktioniert zwar der client aber der server merkt nicht das der client verbunden ist. | ||
![]() |
Goodjee |
![]() Antworten mit Zitat ![]() |
---|---|---|
warum testest du nur, wenn:
If Richtung =0 Then Geschwindigkeit =-8 auf neue verbindungen? |
||
"Ideen sind keine Coladosen, man kann sie nicht recyclen"-Dr. House
http://deeebian.redio.de/ http://goodjee.redio.de/ |
Silernthunt4r |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Das th ich nicht der Befehl sagt nur das wenn die Richtung null ist also wenn der Ball nach links fliegt die Geschwindigkeit -8 sein soll. | ||
Silernthunt4r |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Soo ... ich hab das gemacht was eh nötig war ich hab das ganze noch mal neu geschrieben ( das Netzwerkgewurschdel ) und jetzt gehts. Trotzdem danke an diejenigen die mir versucht haben zu helfen | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group