Hallo Forum
Ich habe Folgendes Problem:
Ich habe in meinem kleinen (noch nicht fertigen) Programm (Tennisspiel) einen Timer eingefügt, der jedesmal stoppt wenn eine der beiden Seiten einen Punkt erzielt,
der Punktestand ändert sich auch dementsprechend (anzeige in einer TextBox), sobald das spiel dann aber weiterläuft wird der Punktestand auf 0 zurückgesetzt
Ist es außerdem möglich, die eingabe in ein Textfeld nicht zu erlauben? Sonst geraten da vllt. mal buchstaben o.ä. rein
Danke schonmal
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44:
| Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim PunkteSpieler As Integer = 0 Dim PunkteComputer As Integer = 0
Ball.Left -= links Ball.Top -= oben
If Ball.Top <= 0 Then oben = -10 If Ball.Bottom >= 345 Then oben = +10
' If Ball.Left <= 6.5 Then Timer1.Stop() If Ball.Left <= 6.5 Then x = True Else x = False If x = True Then PunkteComputer += 1 If x = True Then Ball.Location = New Point(321, 165)
'If Ball.Right >= 642 Then Timer1.Stop() If Ball.Right > 642 Then y = True Else y = False If y = True Then PunkteSpieler += 1 If y = True Then Ball.Location = New Point(321, 165)
TextBox1.Text = PunkteSpieler.ToString TextBox2.Text = PunkteComputer.ToString
Plattform1.Top = MousePosition.Y - 240
If Ball.Top > Plattform2.Top Then Plattform2.Top += 5 Else Plattform2.Top -= 5
If Ball.Left <= Plattform1.Right Then If Ball.Bottom >= Plattform1.Top Then If Ball.Top <= Plattform1.Bottom Then links = -10 End If End If
If Ball.Right >= Plattform2.Left Then If Ball.Bottom >= Plattform2.Top Then If Ball.Top <= Plattform2.Bottom Then links = +10 End If End If
End Sub |
Moderiert von
Th69: Topic aus C# - Die Sprache verschoben am Do 30.01.2014 um 09:11