Wie finden ihr das Spiel? 14
-
Gut (8) 57%
-
Geht so (5) 36%
-
Schlecht (1) 7%
Hallo, ich habe auch mal wieder was zu Posten^^
Greek hat ja mit Ping Pong angefangen und ich fand die Idee gut, also war ich so frech und hab mir die Idee geklaut
Ich hab es aber nicht in GDI+ gemacht, was Greek machen will
Ich weiß das ich es noch kürzen könnte also das Brauch ihr mir nicht sagen
Wenn ich mal Zeit und Lust habe werde ich das dann auch noch mal Überarbeiten
Naja hier das Script:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Pong", 142, 92, 193, 125)
$Slider1 = GUICtrlCreateSlider(0, 26, 139, 35)
GUICtrlSetLimit(-1, 10, 1)
GUICtrlSetData(-1, 5)
$Label1 = GUICtrlCreateLabel("Schwierigkeitsgrad", 2, 2, 113, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Button1 = GUICtrlCreateButton("Play", 2, 62, 131, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
ExitLoop
EndSwitch
WEnd
$Read = GuiCtrlRead ($Slider1)
If $Read = "1" Then
$PZ = StringSplit (@DesktopHeight /100 *20,".")
$Speed = 10
$Speed2 = 15
$PCSpeed = 8
$PCSpeed2 = 20
ElseIf $Read = 2 Then
$PZ = StringSplit (@DesktopHeight /100 *17,".")
$Speed = 13
$Speed2 = 14
$PCSpeed = 10
$PCSpeed2 = 18
ElseIf $Read = 3 Then
$PZ = StringSplit (@DesktopHeight /100 *15,".")
$Speed = 15
$Speed2 = 13
$PCSpeed = 12
$PCSpeed2 = 16
ElseIf $Read = 4 Then
$PZ = StringSplit (@DesktopHeight /100 *12,".")
$Speed = 20
$Speed2 = 12
$PCSpeed = 14
$PCSpeed2 = 14
ElseIf $Read = 5 Then
$PZ = StringSplit (@DesktopHeight /100 *10,".")
$Speed = 20
$Speed2 = 10
$PCSpeed = 15
$PCSpeed2 = 10
ElseIf $Read = 6 Then
$PZ = StringSplit (@DesktopHeight /100 *9,".")
$Speed = 22
$Speed2 = 10
$PCSpeed = 17
$PCSpeed2 = 10
ElseIf $Read = 7 Then
$PZ = StringSplit (@DesktopHeight /100 *8,".")
$Speed = 24
$Speed2 = 10
$PCSpeed = 19
$PCSpeed2 = 10
ElseIf $Read = 8 Then
$PZ = StringSplit (@DesktopHeight /100 *7,".")
$Speed = 26
$Speed2 = 10
$PCSpeed = 21
$PCSpeed2 = 10
ElseIf $Read = 9 Then
$PZ = StringSplit (@DesktopHeight /100 *6,".")
$Speed = 28
$Speed2 = 10
$PCSpeed = 23
$PCSpeed2 = 10
ElseIf $Read = 10 Then
$PZ = StringSplit (@DesktopHeight /100 *5,".")
$Speed = 32
$Speed2 = 10
$PCSpeed = 32
$PCSpeed2 = 10
EndIf
GUIDelete ($Form1)
$Prozent = $PZ[1]
$Abstand = 15
$Prozent2 = @DesktopHeight /100
$Plus = Random (1, 5,1)
$Old = $Abstand
$Mitte = @DesktopWidth /2
$Mitte2 = @DesktopHeight /2
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", @DesktopWidth, @DesktopHeight, -3, -29)
GUISetBkColor (0x000000)
GUISetCursor (16,True)
$Label1 = GUICtrlCreateLabel ("",20,$Abstand,20,$Prozent)
GUICtrlSetBkColor (-1,0x0000FF)
$Label2 = GUICtrlCreateLabel ("",@DesktopWidth - 40,$Abstand,20,$Prozent)
GUICtrlSetBkColor (-1,0x0000FF)
$Ball = GUICtrlCreateLabel ("",$Mitte,Random ($Abstand ,@DesktopHeight - $Prozent2 - $Abstand,1),10,10);
GUICtrlSetBkColor (-1,0xFF0000)
$RamenO = GUICtrlCreateLabel ("",0,0,@DesktopWidth,$Prozent2)
GUICtrlSetBkColor (-1,0x11F11F)
$RamenU = GUICtrlCreateLabel ("",0,@DesktopHeight -$Prozent2,@DesktopWidth,$Prozent2)
GUICtrlSetBkColor (-1,0x11F11F)
GUISetState(@SW_SHOW)
$Zahl1 = GUICtrlCreateLabel ("0",$Mitte -150,50,$Mitte -($Mitte -125),65,0x0002)
GUICtrlSetColor (-1,0xFFFFFF)
GUICtrlSetFont (-1,50,50,800,"Arial")
$Zahl2 = GUICtrlCreateLabel ("0",$Mitte +5,50,150,65)
GUICtrlSetColor (-1,0xFFFFFF)
GUICtrlSetFont (-1,50,50,800,"Arial")
$1 = GUICtrlCreateLabel (":",$Mitte -20,45,20,65)
GUICtrlSetColor (-1,0xFFFFFF)
GUICtrlSetFont (-1,50,50,800,"Arial")
$Angabe = GUICtrlCreateLabel ("",$Mitte -283,$Mitte2 -32,566,65)
GUICtrlSetColor (-1,0xFFFFFF)
GUICtrlSetFont (-1,50,50,800,"Arial")
$Button1 = GUICtrlCreateButton ("",0,0,0,0)
GUICtrlSetState (-1,$GUI_HIDE)
Dim $Form2_AccelTable[1][2] = [["{esc}", $Button1]]
GUISetAccelerators($Form2_AccelTable)
#EndRegion ### END Koda GUI section ###
$Beginn = TimerInit ()
$Beginn2 = TimerInit ()
Dim $Richtung[2]
$Richtung[0] = Random (1,2,1)
$Richtung[1] = Random (1,2,1)
While 1
Sleep (10)
If _IsPressed ("20") Then
ExitLoop
EndIf
WEnd
While 1
Sleep (10)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
If Not _IsPressed ("20") Then
ExitLoop
EndIf
WEnd
While 1
If TimerDiff ($Beginn2) > $PCSpeed2 Then
$Pos1 = ControlGetPos ($Form1,"",$Ball)
If _IsPressed ("20") Then
While 1
Sleep (10)
If Not _IsPressed ("20") Then
ExitLoop
EndIf
WEnd
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
Sleep (10)
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
If _IsPressed ("20") Then
ExitLoop
EndIf
WEnd
While 1
Sleep (10)
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
If Not _IsPressed ("20") Then
ExitLoop
EndIf
WEnd
EndIf
If $Richtung[0] = 2 And $Pos1[0] > $Mitte Then _PcPlay()
$Beginn2 = TimerInit ()
EndIf
If TimerDiff ($Beginn) > $Speed2 Then
_Ball($Richtung[0],$Richtung[1])
$Beginn = TimerInit ()
EndIf
$Pos = GUIGetCursorInfo ()
If $Pos <> $Old Then _Move($Pos)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
WEnd
Func _Move($Pos)
Local $Pos2
$Pos2 = ControlGetPos ($Form1,"",$Label1)
If IsArray ($Pos) And IsArray ($Pos2) Then
If $Pos[1] > $Abstand And $Pos[1] < @DesktopHeight - $Prozent - $Abstand Then
ControlMove ($Form1,"",$Label1,20,$Pos[1])
ElseIf $Pos[1] < $Abstand Then
If $Pos2[1] > $Abstand Then
ControlMove ($Form1,"",$Label1,20,$Abstand)
EndIf
ElseIf $Pos[1] > @DesktopHeight - $Prozent - $Abstand Then
If $Pos2[1] < @DesktopHeight - $Prozent - $Abstand Then
ControlMove ($Form1,"",$Label1,20,@DesktopHeight - $Prozent - $Abstand)
EndIf
EndIf
$Old = $Pos2[1]
$PosL1 = ControlGetPos ($Form1,"",$Label1)
$PosL2 = ControlGetPos ($Form1,"",$Label2)
$PosB = ControlGetPos ($Form1,"",$Ball)
If $PosL1[0] > $PosB[0] Or $PosL2[0] + $PosL2[2] < $PosB[0] Then
If $PosB[0] > $Mitte Then
GUICtrlSetData ($Zahl1,GUICtrlRead ($Zahl1) +1)
ElseIf $PosB[0] < $Mitte Then
GUICtrlSetData ($Zahl2,GUICtrlRead ($Zahl2) +1)
EndIf
_New()
EndIf
EndIf
EndFunc
Func _Ball($X,$Y)
Local $Pos1,$Pos2,$Pos3,$Pos4,$Pos5,$Mitte,$Treff
Local $Pral[4]
For $1 = 0 To 3
$Pral[$1] = False
Next
$Pos1 = ControlGetPos ($Form1,"",$Ball)
$Pos2 = ControlGetPos ($Form1,"",$Label1)
$Pos3 = ControlGetPos ($Form1,"",$Label2)
$Pos4 = ControlGetPos ($Form1,"",$RamenO)
$Pos5 = ControlGetPos ($Form1,"",$RamenU)
$Mitte = StringSplit ($Pos2[3] /2,".")
$Teile = StringSplit ($Pos2[3] /8,".")
If IsArray ($Pos1) And IsArray ($Pos2) And IsArray ($Pos3) And IsArray ($Pos4) And IsArray ($Pos5) Then
If $X = 1 Then
If $Y = 1 Then
If $Pos1[0] - $Speed <= $Pos2[0] + $Pos2[2] And $Pos1[1] - $Plus > $Pos2[1] And $Pos1[1] - $Plus < $Pos2[1] + $Pos2[3] Then $Pral[0] = True
If $Pos4[1] + $Pos4[3] +1 > $Pos1[1] - $Plus Then $Pral[1] = True
If $Pral[0] = True Then
ControlMove ($Form1,"",$Ball,$Pos2[0] + $Pos2[2],$Pos1[1] - $Plus)
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label1,0x0000FF)
$Richtung[0] = 2
$Treff = $Pos1[1] - $Pos2[1]
If $Treff >= $Mitte[1] Then
$Status = "-"
$Treff = $Treff - $Mitte[1]
ElseIf $Treff < $Mitte[1] Then
$Treff = $Mitte[1] - $Treff
$Status = "+"
EndIf
If $Treff < $Teile[1] Then
$Treff = 1
ElseIf $Treff < $Teile[1] *2 Then
$Treff = 2
ElseIf $Treff < $Teile[1] *3 Then
$Treff = 3
EndIf
If $Treff < 4 Then
If $Status = "+" Then
$Plus = $Plus + $Treff
ElseIf $Status = "-" Then
$Plus = $Plus - $Treff
EndIf
EndIf
ElseIf $Pral[1] = True Then
ControlMove ($Form1,"",$Ball,$Pos1[0] - $Speed,$Pos1[1] + $Plus)
$Richtung[1] = 2
Else
ControlMove ($Form1,"",$Ball,$Pos1[0] - $Speed,$Pos1[1] - $Plus)
EndIf
ElseIf $Y = 2 Then
If $Pos1[0] - $Speed <= $Pos2[0] + $Pos2[2] And $Pos1[1] + $Plus > $Pos2[1] And $Pos1[1] + $Plus < $Pos2[1] + $Pos2[3] Then $Pral[0] = True
If $Pos5[1] <= $Pos1[1] + $Plus + $Pos1[3] Then $Pral[1] = True
If $Pral[0] = True Then
ControlMove ($Form1,"",$Ball,$Pos2[0] + $Pos2[2],$Pos1[1] - $Plus)
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label1,0x0000FF)
$Richtung[0] = 2
$Treff = $Pos1[1] - $Pos2[1]
If $Treff >= $Mitte[1] Then
$Status = "+"
$Treff = $Treff - $Mitte[1]
ElseIf $Treff < $Mitte[1] Then
$Treff = $Mitte[1] - $Treff
$Status = "-"
EndIf
If $Treff < $Teile[1] Then
$Treff = 1
ElseIf $Treff < $Teile[1] *2 Then
$Treff = 2
ElseIf $Treff < $Teile[1] *3 Then
$Treff = 3
EndIf
If $Treff < 4 Then
If $Status = "+" Then
$Plus = $Plus + $Treff
ElseIf $Status = "-" Then
$Plus = $Plus - $Treff
EndIf
EndIf
ElseIf $Pral[1] = True Then
ControlMove ($Form1,"",$Ball,$Pos1[0] - $Speed,$Pos1[1] - $Plus)
$Richtung[1] = 1
Else
ControlMove ($Form1,"",$Ball,$Pos1[0] - $Speed,$Pos1[1] + $Plus)
EndIf
EndIf
ElseIf $X = 2 Then
If $Y = 1 Then
If $Pos1[0] + $Speed >= $Pos3[0] -$Pos1[3] And $Pos1[1] - $Plus > $Pos3[1] And $Pos1[1] - $Plus < $Pos3[1] + $Pos3[3] Then $Pral[0] = True
If $Pos4[1] + $Pos4[3] >= $Pos1[1] - $Plus Then $Pral[1] = True
If $Pral[0] = True Then
ControlMove ($Form1,"",$Ball,$Pos3[0] -$Pos1[3],$Pos1[1] - $Plus)
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label2,0x0000FF)
$Richtung[0] = 1
$Treff = $Pos1[1] - $Pos2[1]
If $Treff >= $Mitte[1] Then
$Status = "-"
$Treff = $Treff - $Mitte[1]
ElseIf $Treff < $Mitte[1] Then
$Treff = $Mitte[1] - $Treff
$Status = "+"
EndIf
If $Treff < $Teile[1] Then
$Treff = 1
ElseIf $Treff < $Teile[1] *2 Then
$Treff = 2
ElseIf $Treff < $Teile[1] *3 Then
$Treff = 3
EndIf
If $Treff < 4 Then
If $Status = "+" Then
$Plus = $Plus + $Treff
ElseIf $Status = "-" Then
$Plus = $Plus - $Treff
EndIf
EndIf
ElseIf $Pral[1] = True Then
ControlMove ($Form1,"",$Ball,$Pos1[0] + $Speed,$Pos1[1] + $Plus)
$Richtung[1] = 2
Else
ControlMove ($Form1,"",$Ball,$Pos1[0] + $Speed,$Pos1[1] - $Plus)
EndIf
ElseIf $Y = 2 Then
If $Pos1[0] + $Speed >= $Pos3[0] -$Pos1[3] And $Pos1[1] + $Plus > $Pos3[1] And $Pos1[1] + $Plus < $Pos3[1] + $Pos3[3] Then $Pral[0] = True
If $Pos5[1] <= $Pos1[1] + $Plus + $Pos1[3] Then $Pral[1] = True
If $Pral[0] = True Then
ControlMove ($Form1,"",$Ball,$Pos3[0] -$Pos1[3],$Pos1[1] + $Plus)
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label2,0x0000FF)
$Richtung[0] = 1
$Treff = $Pos1[1] - $Pos2[1]
If $Treff >= $Mitte[1] Then
$Treff = $Treff - $Mitte[1]
$Status = "+"
ElseIf $Treff < $Mitte[1] Then
$Treff = $Mitte[1] - $Treff
$Status = "-"
EndIf
If $Treff < $Teile[1] Then
$Treff = 1
ElseIf $Treff < $Teile[1] *2 Then
$Treff = 2
ElseIf $Treff < $Teile[1] *3 Then
$Treff = 3
EndIf
If $Treff < 4 Then
If $Status = "+" Then
$Plus = $Plus + $Treff
ElseIf $Status = "-" Then
$Plus = $Plus - $Treff
EndIf
EndIf
ElseIf $Pral[1] = True Then
ControlMove ($Form1,"",$Ball,$Pos1[0] + $Speed,$Pos1[1] - $Plus)
$Richtung[1] = 1
Else
ControlMove ($Form1,"",$Ball,$Pos1[0] + $Speed,$Pos1[1] + $Plus)
EndIf
EndIf
EndIf
EndIf
EndFunc
Func _PcPlay()
Local $Pos,$Pos2,$Mitte,$Bewegen
$PosA = ControlGetPos ($Form1,"",$Ball)
$PosB = ControlGetPos ($Form1,"",$Label2)
$Mitte = StringSplit ($PosB[3] /2,".")
$PosA[1] = $PosA[1] - $Mitte[1]
If $PosB[1] > $PosA[1] Then
If $PosB[1] - $PCSpeed > $Abstand Then
ControlMove ($Form1,"",$Label2,@DesktopWidth -40,$PosB[1] - $PCSpeed)
ElseIf $PosB[1] > $Abstand Then
ControlMove ($Form1,"",$Label2,@DesktopWidth -40,$Abstand)
EndIf
ElseIf $PosB[1] + $PCSpeed < $PosA[1] Then
If $PosB[1] + $PCSpeed < @DesktopHeight - $Abstand -$Prozent Then
ControlMove ($Form1,"",$Label2,@DesktopWidth -40,$PosB[1] + $PCSpeed)
ElseIf $PosB[1] > $Abstand Then
ControlMove ($Form1,"",$Label2,@DesktopWidth -40,@DesktopHeight - $Abstand -$Prozent)
EndIf
EndIf
EndFunc
Func _New()
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label1,0x0000FF)
GUICtrlSetBkColor ($Label2,0x0000FF)
If GuiCtrlRead($Zahl1) = "10" Then
GUICtrlSetData ($Angabe,"Du hast Gewonnen")
GUICtrlSetData ($Zahl1,"0")
GUICtrlSetData ($Zahl2,"0")
ElseIf GuiCtrlRead($Zahl2) = "10" Then
GUICtrlSetData ($Angabe,"Du hast Verloren")
GUICtrlSetData ($Zahl1,"0")
GUICtrlSetData ($Zahl2,"0")
EndIf
$Richtung[0] = Random (1,2,1)
$Richtung[1] = Random (1,2,1)
$Plus = Random (1, 5,1)
ControlMove ($Form1,"",$Ball,$Mitte,Random ($Abstand ,@DesktopHeight - $Prozent2 - $Abstand,1))
While 1
Sleep (10)
If _IsPressed ("20") Then
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
ExitLoop
EndIf
WEnd
While 1
Sleep (10)
If Not _IsPressed ("20") Then
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button1
Exit
EndSwitch
ExitLoop
EndIf
WEnd
GUICtrlSetBkColor ($Ball,0xFF0000)
GUICtrlSetBkColor ($Label1,0x0000FF)
GUICtrlSetBkColor ($Label2,0x0000FF)
GUICtrlSetData ($Angabe,"")
EndFunc
Ich hab noch ein Problem mit den Wänden, der Ball geht komischerweiße manchmal einfach durch die Wand und ich kann einfach nicht den Fehler finden
EDIT:
Und ein Bischen rückmeldung währe auch gut^^