• Wie finden ihr das Spiel? 14

    1. Gut (8) 57%
    2. Geht so (5) 36%
    3. 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 :thumbup:
    Wenn ich mal Zeit und Lust habe werde ich das dann auch noch mal Überarbeiten
    Naja hier das Script:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <Misc.au3>
    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #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 ###

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit]


    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^^

    mfg. Jam00

    2 Mal editiert, zuletzt von Jam00 (8. März 2009 um 18:50)

  • Hey,

    sieht ja ganz ok aus aber ich weiß nich wie du den Schwierigkeitsgrad einstellst, also wenn ich auf voll stelle seh ich den Ball nich mehr, das dauert 0,5 sek und ich hab verloren *g* liegt vllt an der CPU :-/

    Und ein Bug ist wohl noch da, der Ball fliegt ab und zu durch die obere Kante.


    Gruß

    Prajoss

    "Never touch a running System!"

  • Hmm...das der durch die Ecke geht leigt daran das der machmal oben durch die Wand geht, hab ich ja schon geschreiben, hab aber leider auch keine Ahnung warum :(
    Also bei mir gehen alle Schwierigkeitsgrade!

    mfg. Jam00

  • Jam00: Schaut gut aus, aber wie zum T... steuert man den linken Player? ?(

    MfG. tobi_girst

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Nettes spiel, wirklich gut gelungen.

    Die paar Bugs sind ja schon gekannt, die kann man ja beheben.

    Eine Sache is aber net so gut.
    Im hohen Schwirigkeitsmodus hat man keine Chance zu gewinnen.
    Da is der speed zu hoch, aber sonst cool.

    Eins könnte man noch machen. Statt zum starten und stoppen die leehrtaste ( 20 ) zu nehmen, lieber die linke maustaste ( 01 )

    So muss man net immer ne hand an der tastertur haben ^^

  • Also das Spiel gefällt mir soweit.

    Zu bemängeln hätte ich nur, das beim Rundenstart die "Kugel" zu schnell ist, da sie ja vom Mittelpunkt aus startet.

    Anregungen:
    - Starkugel um 25% langsamer machen bis sie das erste mal "getroffen" wurde.
    - Spielabbruch z. B. mit Esc. einbauen

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr

  • Alina:
    Zu idee nummer 1:
    Wäre net schlecht ^^

    Zu Idee nummer 2:
    Man kann es doch schon mit ESC abbrechen...