Schau mal ins Script, das ist alles ausgerechnet worden, muss irgendwo was übersehen haben...
Beiträge von Greek
-
-
Argh das hat noch dicke Fehler bei ner geringen Auflösung
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]; Variablen
[/autoit] [autoit][/autoit] [autoit]
Global $begin
Global $Speed = 1.0, $SpeedBalken = 10, $level = 1
Global $pointsleft = 0, $pointsright = 0
Global $BewegungSenkrecht = Random(5, 7, 1), $BewegungWaagerecht = Random(5, 7, 1)
Global $ballpos1 = @DesktopWidth / 2, $ballpos2 = @DesktopHeight / 2 - 50
Global $Strichpos1 = @DesktopHeight / 2 - 70, $Strichpos2 = @DesktopHeight / 2 + 70
Global $RStrichpos1 = @DesktopHeight / 2 - 70, $RStrichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong", $Rahmenbreite = 10; GUI
[/autoit] [autoit][/autoit] [autoit]
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
Global $Spielstand = GUICtrlCreateLabel("0:0", @DesktopWidth / 2, @DesktopHeight / 15, 600, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$LevelL=GUICtrlCreateLabel ( "Level " & $level, @DesktopWidth/2-100, @DesktopHeight/2-100, 200, 200 )
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GUISetAccelerators($accel)GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(10)
Until _IsPressed("0D") Or _IsPressed("20")GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($LevelL, $GUI_SHOW)
Sleep ( 1500 )
GUICtrlSetState($LevelL, $GUI_HIDE)
GUICtrlSetState($Spielstand, $GUI_SHOW)Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
Global $hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
Global $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
Global $hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()Sleep ( 500 )
[/autoit] [autoit][/autoit] [autoit]AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
Exit
EndFunc ;==>_endeFunc Onautoitexit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
EndFunc ;==>OnautoitexitFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
$PenColor=_GDIPlus_PenGetColor ( $hPenRahmen )
If $PenColor=0xFF0000FF Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFFFF0000 )
ElseIf $PenColor=0xFFFF0000 Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFF00FF00 )
ElseIf $PenColor=0xFF00FF00 Then
_GDIPlus_PenSetColor ( $hPenRahmen, 0xFFFFFF00 )
ElseIf $PenColor=0xFFFFFF00 Then
_GDIPlus_PenSetColor ( $hPenRahmen, 0xFF0000FF )
EndIf
EndFunc ;==>_DrawRahmen
Sleep( 500 )
$begin=TimerInit()
Func _Zyklus()
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
_ball()
_DetectCollision()
_ScoreUpdate()
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - $SpeedBalken, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= $SpeedBalken
$Strichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + $SpeedBalken, $hpen_Del)
$Strichpos1 += $SpeedBalken
$Strichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos2 - $SpeedBalken, @DesktopWidth - 100, $RStrichpos2, $hpen_Del)
$RStrichpos1 -= $SpeedBalken
$RStrichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_hoch2Func _runter2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos1 + $SpeedBalken, $hpen_Del)
$RStrichpos1 += $SpeedBalken
$RStrichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_runter2Func _ball()
[/autoit] [autoit][/autoit] [autoit]
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
$ballpos2 += $BewegungSenkrecht * $Speed
$ballpos1 += $BewegungWaagerecht * $Speed
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
EndFunc ;==>_ballFunc _DetectCollision()
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 <= 120 Then
If ($ballpos2 >= $Strichpos1) And ($ballpos2 <= $Strichpos2) Then ; kollision
If $BewegungWaagerecht < 0 Then
$BewegungWaagerecht = Random(5, 7, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
ElseIf $ballpos1 < 100 Then
setzeausgang(1)
Sleep(1500)
_DrawRahmen()
EndIf
EndIf
If $ballpos1 >= @DesktopWidth - 135 Then
If ($ballpos2 >= $RStrichpos1) And ($ballpos2 <= $RStrichpos2) Then ; kollision
If $BewegungWaagerecht > 0 Then
$BewegungWaagerecht = Random(-7, -5, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
ElseIf $ballpos1 > @DesktopWidth - 100 Then
setzeausgang(0)
Sleep(1500)
_DrawRahmen()
EndIf
EndIfIf $ballpos1 >= @DesktopWidth - 40 And $BewegungWaagerecht > 0 Then $BewegungWaagerecht = Random(-7, -5, 1)
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 < 30 And $BewegungWaagerecht < 0 Then $BewegungWaagerecht = Random(5, 7, 1)
If $ballpos2 >= @DesktopHeight - 40 And $BewegungSenkrecht > 0 Then $BewegungSenkrecht = Random(-7, -5, 1)
If $ballpos2 < 30 And $BewegungSenkrecht < 0 Then $BewegungSenkrecht = Random(5, 7, 1)
EndFunc ;==>_DetectCollisionFunc setzeausgang($points)
[/autoit] [autoit][/autoit] [autoit]
If ($points < 1) Or ($points > 0) Then SetError(1)
Switch $points
Case 0
$pointsleft += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
Case 1
$pointsright += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
EndSwitch;Ball und Schläger übermalen
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, 13, @DesktopWidth - 100, @DesktopHeight - 13, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 13, 100, @DesktopHeight - 13, $hpen_Del);Ball läuft zufallsweise in eine der 4 Richtungen
[/autoit] [autoit][/autoit] [autoit]
If Random(0, 1, 1) Then
$BewegungSenkrecht = Random(1, 11, 1)
Else
$BewegungSenkrecht = Random(-11, -1, 1)
EndIf
If Random(0, 1, 1) Then
$BewegungWaagerecht = Random(1, 11, 1)
Else
$BewegungWaagerecht = Random(-11, -1, 1)
EndIf$ballpos1 = @DesktopWidth / 2
[/autoit] [autoit][/autoit] [autoit]
$ballpos2 = @DesktopHeight / 2 - 50
$Strichpos1 = @DesktopHeight / 2 - 70
$Strichpos2 = @DesktopHeight / 2 + 70
$RStrichpos1 = @DesktopHeight / 2 - 70
$RStrichpos2 = @DesktopHeight / 2 + 70$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndFunc ;==>setzeausgangFunc _ScoreUpdate()
[/autoit]
$dif=TimerDiff( $begin )
If $dif>=100 Then
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
$begin=TimerInit()
EndIf
EndFuncAm Rand fehlt nen Stück und das Label ist dann zu groß ( kann man das irgendwie, wenn die Auflösung kleiner ist das auch das Label kleiner ist machen ? ), guck mal ob ich den Fehler finde wär cool wenn noch einer drüber guckt.
-
[autoit]
#include <WindowsConstants.au3>
[/autoit] -
[autoit]
$Form1 = GUICreate("Form1", 633, 447, 193, 125, $WS_POPUP)
[/autoit]Meinst du glaubich
-
ö versteh nicht ganz was du meinst. Kannst es so z.B. machen
Spoiler anzeigen
[autoit]#cs ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]AutoIt Version: 3.3.0.0
[/autoit] [autoit][/autoit] [autoit]
Author: GreekScript Function:
[/autoit] [autoit][/autoit] [autoit]
Template AutoIt script.#ce ----------------------------------------------------------------------------
[/autoit] [autoit][/autoit] [autoit]; Script Start - Add your code below here
[/autoit] [autoit][/autoit] [autoit]#include <ButtonConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>Global $oMyRet[2]
[/autoit] [autoit][/autoit] [autoit]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")#Region ### START Koda GUI section ### Form=
[/autoit] [autoit][/autoit] [autoit]
$Form1 = GUICreate("Email versender", 396, 294, 1153, 185)
$Input1 = GUICtrlCreateInput("", 8, 40, 121, 21)
$Input2 = GUICtrlCreateInput("", 248, 40, 121, 21)
$Label1 = GUICtrlCreateLabel("Mail sever: Für http://www.web.de ist er smtp.web.de ", 8, 16, 229, 17)
$Label2 = GUICtrlCreateLabel("Name des Absenders", 248, 16, 105, 17)
$Label3 = GUICtrlCreateLabel("Absender email addresse", 8, 72, 122, 17)
$Input3 = GUICtrlCreateInput("", 8, 96, 121, 21)
$Input4 = GUICtrlCreateInput("", 248, 96, 121, 21)
$Label4 = GUICtrlCreateLabel("Empfänger email addresse", 248, 72, 128, 17)
$Input5 = GUICtrlCreateInput("", 8, 152, 121, 21)
$Label5 = GUICtrlCreateLabel("Betreff", 8, 128, 35, 17)
$Label6 = GUICtrlCreateLabel(" Text ", 248, 128, 34, 17)
$Input6 = GUICtrlCreateInput("", 248, 152, 121, 21)
$Label7 = GUICtrlCreateLabel("Nochmal Absender email", 8, 184, 121, 17)
$Input7 = GUICtrlCreateInput("", 8, 208, 121, 21)
$Input8 = GUICtrlCreateInput("", 248, 208, 121, 21)
$Label8 = GUICtrlCreateLabel("Passwort der Absender email", 248, 184, 140, 17)
$Button1 = GUICtrlCreateButton("Email versenden", 152, 248, 100, 25, 0)
$Button2 = GUICtrlCreateButton("Abbrechen", 312, 256, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###While 1
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$rc = _INetSmtpMailCom(GUICtrlRead( $Input1),GUICtrlRead($Input2),GUICtrlRead($Input3), GUICtrlRead($Input4), GUICtrlRead($Input5), GUICtrlRead($Input6), "", "","", GUICtrlRead($Input7), GUICtrlRead($Input8))
If @error then
msgbox(0,"Error sending message","Error code:" & @error & " Description:" & $rc)
EndIf
Case $Button2
Exit
EndSwitch
WEnd
[/autoit]
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
$objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $ex = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment ($S_Files2Attach[$x])
Else
$i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
SetError(1)
return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Sent the Message
$objEmail.Send
if @error then
SetError(2)
return $oMyRet[1]
EndIf
EndFunc;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number,
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description,3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc;==>MyErrFunc -
Ohne ein Programm?
Dann brauchst du _INetSmtpMailCom
Spoiler anzeigen
[autoit]Global $oMyRet[2]
[/autoit]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
$rc = _INetSmtpMailCom($mail_server,$absender_name,$absender_adresse, $empfaenger_adresse, $betreff, $nachrichtentext, $anhang, $cc_emfaenger,$bcc_empfaenger, $mail_benutzername, $mail_passwort)
If @error then
msgbox(0,"Error sending message","Error code:" & @error & " Description:" & $rc)
EndIf
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Username = "", $s_Password = "")
$objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Cc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body,"<") and StringInStr($as_Body,">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $ex = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull ($S_Files2Attach[$x])
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment ($S_Files2Attach[$x])
Else
$i_Error_desciption = $i_Error_desciption & @lf & 'File not found to attach: ' & $S_Files2Attach[$x]
SetError(1)
return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Sent the Message
$objEmail.Send
if @error then
SetError(2)
return $oMyRet[1]
EndIf
EndFunc;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number,
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description,3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc;==>MyErrFunc -
Ne hab kein Vista, hab XP
Ganz extrem ist der Ball bei deiner Version der Flackert sau stark.
Achja und mein Stand zur Zeit
Edit: Nochma nen Bug entfernt
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]; Variablen
[/autoit] [autoit][/autoit] [autoit]
Global $begin
Global $Speed = 1.0, $SpeedBalken = 10, $level = 1
Global $pointsleft = 0, $pointsright = 0
Global $BewegungSenkrecht = Random(5, 7, 1), $BewegungWaagerecht = Random(5, 7, 1)
Global $ballpos1 = @DesktopWidth / 2, $ballpos2 = @DesktopHeight / 2 - 50
Global $Strichpos1 = @DesktopHeight / 2 - 70, $Strichpos2 = @DesktopHeight / 2 + 70
Global $RStrichpos1 = @DesktopHeight / 2 - 70, $RStrichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong", $Rahmenbreite = 10; GUI
[/autoit] [autoit][/autoit] [autoit]
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
Global $Spielstand = GUICtrlCreateLabel("0:0", @DesktopWidth / 2, @DesktopHeight / 15, 600, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)
$LevelL=GUICtrlCreateLabel ( "Level " & $level, @DesktopWidth/2-100, @DesktopHeight/2-100, 200, 200 )
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GUISetAccelerators($accel)GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit]Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(10)
Until _IsPressed("0D") Or _IsPressed("20")GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($LevelL, $GUI_SHOW)
Sleep ( 1500 )
GUICtrlSetState($LevelL, $GUI_HIDE)
GUICtrlSetState($Spielstand, $GUI_SHOW)Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
Global $hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
Global $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
Global $hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()Sleep ( 500 )
[/autoit] [autoit][/autoit] [autoit]AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
Exit
EndFunc ;==>_endeFunc Onautoitexit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
EndFunc ;==>OnautoitexitFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
$PenColor=_GDIPlus_PenGetColor ( $hPenRahmen )
If $PenColor=0xFF0000FF Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFFFF0000 )
ElseIf $PenColor=0xFFFF0000 Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFF00FF00 )
ElseIf $PenColor=0xFF00FF00 Then
_GDIPlus_PenSetColor ( $hPenRahmen, 0xFFFFFF00 )
ElseIf $PenColor=0xFFFFFF00 Then
_GDIPlus_PenSetColor ( $hPenRahmen, 0xFF0000FF )
EndIf
EndFunc ;==>_DrawRahmen
Sleep( 500 )
$begin=TimerInit()
Func _Zyklus()
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
_ball()
_DetectCollision()
_ScoreUpdate()
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - $SpeedBalken, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= $SpeedBalken
$Strichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + $SpeedBalken, $hpen_Del)
$Strichpos1 += $SpeedBalken
$Strichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos2 - $SpeedBalken, @DesktopWidth - 100, $RStrichpos2, $hpen_Del)
$RStrichpos1 -= $SpeedBalken
$RStrichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_hoch2Func _runter2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos1 + $SpeedBalken, $hpen_Del)
$RStrichpos1 += $SpeedBalken
$RStrichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_runter2Func _ball()
[/autoit] [autoit][/autoit] [autoit]
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
$ballpos2 += $BewegungSenkrecht * $Speed
$ballpos1 += $BewegungWaagerecht * $Speed
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
EndFunc ;==>_ballFunc _DetectCollision()
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 <= 120 Then
If ($ballpos2 >= $Strichpos1) And ($ballpos2 <= $Strichpos2) Then ; kollision
If $BewegungWaagerecht < 0 Then
$BewegungWaagerecht = Random(5, 7, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
ElseIf $ballpos1 < 100 Then
setzeausgang(1)
Sleep(1500)
_DrawRahmen()
EndIf
EndIf
If $ballpos1 >= @DesktopWidth - 135 Then
If ($ballpos2 >= $RStrichpos1) And ($ballpos2 <= $RStrichpos2) Then ; kollision
If $BewegungWaagerecht > 0 Then
$BewegungWaagerecht = Random(-7, -5, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
ElseIf $ballpos1 > @DesktopWidth - 100 Then
setzeausgang(0)
Sleep(1500)
_DrawRahmen()
EndIf
EndIfIf $ballpos1 >= @DesktopWidth - 40 And $BewegungWaagerecht > 0 Then $BewegungWaagerecht = Random(-7, -5, 1)
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 < 30 And $BewegungWaagerecht < 0 Then $BewegungWaagerecht = Random(5, 7, 1)
If $ballpos2 >= @DesktopHeight - 40 And $BewegungSenkrecht > 0 Then $BewegungSenkrecht = Random(-7, -5, 1)
If $ballpos2 < 30 And $BewegungSenkrecht < 0 Then $BewegungSenkrecht = Random(5, 7, 1)
EndFunc ;==>_DetectCollisionFunc setzeausgang($points)
[/autoit] [autoit][/autoit] [autoit]
If ($points < 1) Or ($points > 0) Then SetError(1)
Switch $points
Case 0
$pointsleft += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
Case 1
$pointsright += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
EndSwitch;Ball und Schläger übermalen
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, 13, @DesktopWidth - 100, @DesktopHeight - 13, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 13, 100, @DesktopHeight - 13, $hpen_Del);Ball läuft zufallsweise in eine der 4 Richtungen
[/autoit] [autoit][/autoit] [autoit]
If Random(0, 1, 1) Then
$BewegungSenkrecht = Random(1, 11, 1)
Else
$BewegungSenkrecht = Random(-11, -1, 1)
EndIf
If Random(0, 1, 1) Then
$BewegungWaagerecht = Random(1, 11, 1)
Else
$BewegungWaagerecht = Random(-11, -1, 1)
EndIf$ballpos1 = @DesktopWidth / 2
[/autoit] [autoit][/autoit] [autoit]
$ballpos2 = @DesktopHeight / 2 - 50
$Strichpos1 = @DesktopHeight / 2 - 70
$Strichpos2 = @DesktopHeight / 2 + 70
$RStrichpos1 = @DesktopHeight / 2 - 70
$RStrichpos2 = @DesktopHeight / 2 + 70$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndFunc ;==>setzeausgangFunc _ScoreUpdate()
[/autoit]
$dif=TimerDiff( $begin )
If $dif>=100 Then
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright)
$begin=TimerInit()
EndIf
EndFunc -
Außer dem Spielstand flimmert aber alles bei deiner Version genau so

-
Joar das mit dem Flackern weis ich auch nicht anders bis jetzt, muss mal schauen ob ich das noch reduzieren kann, aber das mit dem Level ist bei mir nicht, liegt wohl an deiner Auflösung, aber ist auch egal das mit dem Level 1 Mach ich noch anders, ich lass es einfach kurz aufleuchten vor beginn.
-
Joar aber will das jetzt nicht einfach so übernehmen

Ich versuch das mal alles so ein bissel zu vermatschen

Hab noch was neues Reingemacht, guckt es euch mal an, sieht schön aus =)
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]; Variablen
[/autoit] [autoit][/autoit] [autoit]
Global $begin
Global $Speed = 1.0, $SpeedBalken = 10, $level = 1
Global $pointsleft = 0, $pointsright = 0
Global $BewegungSenkrecht = Random(5, 7, 1), $BewegungWaagerecht = Random(5, 7, 1)
Global $ballpos1 = @DesktopWidth / 2, $ballpos2 = @DesktopHeight / 2 - 50
Global $Strichpos1 = @DesktopHeight / 2 - 70, $Strichpos2 = @DesktopHeight / 2 + 70
Global $RStrichpos1 = @DesktopHeight / 2 - 70, $RStrichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong", $Rahmenbreite = 10; GUI
[/autoit] [autoit][/autoit] [autoit]
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
Global $Spielstand = GUICtrlCreateLabel("0:0" & @TAB & @TAB & 'Level 1', @DesktopWidth / 2, @DesktopHeight / 15, 600, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(10)
Until _IsPressed("0D") Or _IsPressed("20")GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($Spielstand, $GUI_SHOW)Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
Global $hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
Global $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
Global $hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit]Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GUISetAccelerators($accel)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
Exit
EndFunc ;==>_endeFunc Onautoitexit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
EndFunc ;==>OnautoitexitFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
$PenColor=_GDIPlus_PenGetColor ( $hPenRahmen )
If $PenColor=0xFF0000FF Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFFFF0000 )
ElseIf $PenColor=0xFFFF0000 Then
_GDIPlus_PenSetColor( $hPenRahmen, 0xFF00FF00 )
ElseIf $PenColor=0xFF00FF00 Then
_GDIPlus_PenSetColor ( $hPenRahmen, 0xFF0000FF )
EndIf
EndFunc ;==>_DrawRahmen
Sleep( 500 )
$begin=TimerInit()
Func _Zyklus()
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
_ball()
_DetectCollision()
_ScoreUpdate()
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - $SpeedBalken, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= $SpeedBalken
$Strichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + $SpeedBalken, $hpen_Del)
$Strichpos1 += $SpeedBalken
$Strichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos2 - $SpeedBalken, @DesktopWidth - 100, $RStrichpos2, $hpen_Del)
$RStrichpos1 -= $SpeedBalken
$RStrichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_hoch2Func _runter2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos1 + $SpeedBalken, $hpen_Del)
$RStrichpos1 += $SpeedBalken
$RStrichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_runter2Func _ball()
[/autoit] [autoit][/autoit] [autoit]
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
$ballpos2 += $BewegungSenkrecht * $Speed
$ballpos1 += $BewegungWaagerecht * $Speed
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
EndFunc ;==>_ballFunc _DetectCollision()
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 <= 120 Then
If ($ballpos2 >= $Strichpos1) And ($ballpos2 <= $Strichpos2) Then ; kollision
If $BewegungWaagerecht < 0 Then
$BewegungWaagerecht = Random(5, 7, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
ElseIf $ballpos1 < 100 Then
setzeausgang(1)
Sleep(1500)
_DrawRahmen()
EndIf
EndIf
If $ballpos1 >= @DesktopWidth - 135 Then
If ($ballpos2 >= $RStrichpos1) And ($ballpos2 <= $RStrichpos2) Then ; kollision
If $BewegungWaagerecht > 0 Then
$BewegungWaagerecht = Random(-7, -5, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
ElseIf $ballpos1 > @DesktopWidth - 100 Then
setzeausgang(0)
Sleep(1500)
_DrawRahmen()
EndIf
EndIfIf $ballpos1 >= @DesktopWidth - 40 And $BewegungWaagerecht > 0 Then $BewegungWaagerecht = Random(-7, -5, 1)
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 < 30 And $BewegungWaagerecht < 0 Then $BewegungWaagerecht = Random(5, 7, 1)
If $ballpos2 >= @DesktopHeight - 40 And $BewegungSenkrecht > 0 Then $BewegungSenkrecht = Random(-7, -5, 1)
If $ballpos2 < 30 And $BewegungSenkrecht < 0 Then $BewegungSenkrecht = Random(5, 7, 1)
EndFunc ;==>_DetectCollisionFunc setzeausgang($points)
[/autoit] [autoit][/autoit] [autoit]
If ($points < 1) Or ($points > 0) Then SetError(1)
Switch $points
Case 0
$pointsleft += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
Case 1
$pointsright += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
EndSwitch;Ball und Schläger übermalen
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, 13, @DesktopWidth - 100, @DesktopHeight - 13, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 13, 100, @DesktopHeight - 13, $hpen_Del);Ball läuft zufallsweise in eine der 4 Richtungen
[/autoit] [autoit][/autoit] [autoit]
If Random(0, 1, 1) Then
$BewegungSenkrecht = Random(1, 11, 1)
Else
$BewegungSenkrecht = Random(-11, -1, 1)
EndIf
If Random(0, 1, 1) Then
$BewegungWaagerecht = Random(1, 11, 1)
Else
$BewegungWaagerecht = Random(-11, -1, 1)
EndIf$ballpos1 = @DesktopWidth / 2
[/autoit] [autoit][/autoit] [autoit]
$ballpos2 = @DesktopHeight / 2 - 50
$Strichpos1 = @DesktopHeight / 2 - 70
$Strichpos2 = @DesktopHeight / 2 + 70
$RStrichpos1 = @DesktopHeight / 2 - 70
$RStrichpos2 = @DesktopHeight / 2 + 70$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndFunc ;==>setzeausgangFunc _ScoreUpdate()
[/autoit]
$dif=TimerDiff( $begin )
If $dif>=100 Then
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
$begin=TimerInit()
EndIf
EndFunc -
Ich verfolge dieses Thema von Anfang an, und ich muss sagen, echt geil

Weiter so
Gut wäre noch die Score Anzeige auf einer anderen Ebene anzuordnen.Hey cool freut mich =D
So hab auch nochmal was verbessert:
Gibt jetzt ne _ScoreUpdate Funktion damit das nicht einfach übermalt wird.Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]; Variablen
[/autoit] [autoit][/autoit] [autoit]
Global $begin
Global $Speed = 1.0, $SpeedBalken = 10, $level = 1
Global $pointsleft = 0, $pointsright = 0
Global $BewegungSenkrecht = Random(5, 7, 1), $BewegungWaagerecht = Random(5, 7, 1)
Global $ballpos1 = @DesktopWidth / 2, $ballpos2 = @DesktopHeight / 2 - 50
Global $Strichpos1 = @DesktopHeight / 2 - 70, $Strichpos2 = @DesktopHeight / 2 + 70
Global $RStrichpos1 = @DesktopHeight / 2 - 70, $RStrichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong", $Rahmenbreite = 10; GUI
[/autoit] [autoit][/autoit] [autoit]
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
Global $Spielstand = GUICtrlCreateLabel("0:0" & @TAB & @TAB & 'Level 1', @DesktopWidth / 2, @DesktopHeight / 15, 600, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUICtrlSetState(-1, $GUI_HIDE)
GUISetState(@SW_SHOW)Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(10)
Until _IsPressed("0D") Or _IsPressed("20")GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]
GUICtrlSetState($Spielstand, $GUI_SHOW)Global $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
Global $hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
Global $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
Global $hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit]Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GUISetAccelerators($accel)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
Exit
EndFunc ;==>_endeFunc Onautoitexit()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_PenDispose($hPen)
_GDIPlus_PenDispose($hPenRahmen)
_GDIPlus_PenDispose($hpen_Del)
;~ _GDIPlus_Shutdown() ; <-- funzt nicht
EndFunc ;==>OnautoitexitFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
EndFunc ;==>_DrawRahmen
Sleep( 500 )
$begin=TimerInit()
Func _Zyklus()
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
_ball()
_DetectCollision()
_ScoreUpdate()
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - $SpeedBalken, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= $SpeedBalken
$Strichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + $SpeedBalken, $hpen_Del)
$Strichpos1 += $SpeedBalken
$Strichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos2 - $SpeedBalken, @DesktopWidth - 100, $RStrichpos2, $hpen_Del)
$RStrichpos1 -= $SpeedBalken
$RStrichpos2 -= $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_hoch2Func _runter2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos1 + $SpeedBalken, $hpen_Del)
$RStrichpos1 += $SpeedBalken
$RStrichpos2 += $SpeedBalken
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_runter2Func _ball()
[/autoit] [autoit][/autoit] [autoit]
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
$ballpos2 += $BewegungSenkrecht * $Speed
$ballpos1 += $BewegungWaagerecht * $Speed
$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
EndFunc ;==>_ballFunc _DetectCollision()
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 <= 120 Then
If ($ballpos2 >= $Strichpos1) And ($ballpos2 <= $Strichpos2) Then ; kollision
If $BewegungWaagerecht < 0 Then
$BewegungWaagerecht = Random(5, 7, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
ElseIf $ballpos1 < 100 Then
setzeausgang(1)
Sleep(1500)
EndIf
EndIf
If $ballpos1 >= @DesktopWidth - 135 Then
If ($ballpos2 >= $RStrichpos1) And ($ballpos2 <= $RStrichpos2) Then ; kollision
If $BewegungWaagerecht > 0 Then
$BewegungWaagerecht = Random(-7, -5, 1)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
ElseIf $ballpos1 > @DesktopWidth - 100 Then
setzeausgang(0)
Sleep(1500)
EndIf
EndIfIf $ballpos1 >= @DesktopWidth - 40 And $BewegungWaagerecht > 0 Then $BewegungWaagerecht = Random(-7, -5, 1)
[/autoit] [autoit][/autoit] [autoit]
If $ballpos1 < 30 And $BewegungWaagerecht < 0 Then $BewegungWaagerecht = Random(5, 7, 1)
If $ballpos2 >= @DesktopHeight - 40 And $BewegungSenkrecht > 0 Then $BewegungSenkrecht = Random(-7, -5, 1)
If $ballpos2 < 30 And $BewegungSenkrecht < 0 Then $BewegungSenkrecht = Random(5, 7, 1)
EndFunc ;==>_DetectCollisionFunc setzeausgang($points)
[/autoit] [autoit][/autoit] [autoit]
If ($points < 1) Or ($points > 0) Then SetError(1)
Switch $points
Case 0
$pointsleft += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
Case 1
$pointsright += 1
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
EndSwitch;Ball und Schläger übermalen
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, 13, @DesktopWidth - 100, @DesktopHeight - 13, $hpen_Del)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, 13, 100, @DesktopHeight - 13, $hpen_Del);Ball läuft zufallsweise in eine der 4 Richtungen
[/autoit] [autoit][/autoit] [autoit]
If Random(0, 1, 1) Then
$BewegungSenkrecht = Random(1, 11, 1)
Else
$BewegungSenkrecht = Random(-11, -1, 1)
EndIf
If Random(0, 1, 1) Then
$BewegungWaagerecht = Random(1, 11, 1)
Else
$BewegungWaagerecht = Random(-11, -1, 1)
EndIf$ballpos1 = @DesktopWidth / 2
[/autoit] [autoit][/autoit] [autoit]
$ballpos2 = @DesktopHeight / 2 - 50
$Strichpos1 = @DesktopHeight / 2 - 70
$Strichpos2 = @DesktopHeight / 2 + 70
$RStrichpos1 = @DesktopHeight / 2 - 70
$RStrichpos2 = @DesktopHeight / 2 + 70$ball = _GDIPlus_GraphicsDrawArc($hGraphic, $ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndFunc ;==>setzeausgangFunc _ScoreUpdate()
[/autoit]
$dif=TimerDiff( $begin )
If $dif>=100 Then
GUICtrlSetData($Spielstand, $pointsleft & ':' & $pointsright & @TAB & @TAB & 'Level ' & $level)
$begin=TimerInit()
EndIf
EndFunc -
Wie das verändert sich alles?

Gibt viele Wege sowas anzusteuern:
ID - The internal control ID. The Control ID is the internal numeric identifier that windows gives to each control. It is generally the best method of identifying controls. In addition to the AutoIt Window Info Tool, other applications such as screenreaders for the blind and Microsoft tools/APIs may allow you to get this Control ID
TEXT - The text on a control, for example "&Next" on a button
CLASS - The internal control classname such as "Edit" or "Button"
CLASSNN - The ClassnameNN value as used in previous versions of AutoIt, such as "Edit1"
REGEXPCLASS - Control classname using a regular expression
X \ Y \ W \ H - The position and size of a control.
INSTANCE - The 1-based instance when all given properties match.Oder sogar mit den Coordinaten im GUI [CLASS:Edit; X:11; Y:11; W:528; H:20]
-
Hm was soll das Programm den machen? Einfach nur Internetseiten öffnen?
Spoiler anzeigen
[autoit]#include <ButtonConstants.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
$Gui = GUICreate("SB Hp Suche", 600, 500)
GUISetBkColor(0x006633)
HotKeySet("{F4}", "test")
HotKeySet("{F5}","info")$Input1 = GUICtrlCreateInput("Simon Webstation", 10, 30, 580)
[/autoit] [autoit][/autoit] [autoit]
$search = GUICtrlCreateButton("Suchen", 270, 65, 100, 25, $BS_DEFPUSHBUTTON)
$label = GUICtrlCreateLabel("", 10, 100, 400, 350)
GUICtrlSetFont(-1,14)
GUICtrlSetColor(-2,0xFFFFFF)
$describe = GUICtrlCreateLabel("",10,120,400,350)
GUICtrlSetFont(-1,12)
GUICtrlSetColor(-2,0xCDCD00)
$label2 = GUICtrlCreateLabel("",10,150,400,350)
GUICtrlSetFont(-1,14)
GUICtrlSetColor(-2,0xFFFFFF)
$describe2 = GUICtrlCreateLabel("",10,170,400,350)
GUICtrlSetFont(-1,12)
GUICtrlSetColor(-2,0xCDCD00)
[/autoit] [autoit][/autoit] [autoit]
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $describe
If $describe = "http://www.simon-webstation.de" Then ShellExecute("http://www.simon-webstation.de")
Case $search
$input = GUICtrlRead($Input1)
$read = GUICtrlRead($label)
ShellExecute ( $input )
;~ If $input = "Simon Webstation" Or $input = "simon-webstatio" Or $input = "Simon-Webstation" Or $input = "simon-webstation" Then
;~ GUICtrlSetData($label, "Simon-Webstation")
;~ GUICtrlSetData($describe,"http://www.simon-webstation.de")
;~ GUICtrlSetData($label2,"Firetiger-Linkliste")
;~ GUICtrlSetData($describe2,"http://www.firetiger.de/linkliste.php")
;~
;~ Else
;~ GUICtrlSetData($label, $read & "Es wurde nichts vorhandenes eingegeben" & @CRLF)
;~ EndIf
EndSwitch
WEnd
Func test()
Exit
EndFunc ;==>testFunc info()
[/autoit]
MsgBox(0,"Info","Für Infos musst du insgästebuch schreiben auf http://www.simon-webstation.de")
EndFunc ;==>info -
Bei mir Funzt es auch und zeigt 21,8 an.
-
Den Teil muss ich umschreiben?
Spoiler anzeigen
[autoit]Switch $signx
[/autoit]
Case "-"
If $next[0] > $width1 AND $next[0] < $width1 + $padw Then
If $next[1] > ($pad1[1] - $bsize * 2) AND $next[1] < ($pad1[1] + $padh) Then
Sign("x")
$maxa = $maxa + Random(0, 1, 1)
$speed[0] = $speed[0] + Random(0, 1, 1)
$speed[1] = Random(1, $maxa, 1)
$hits = $hits + 1
EndIf
EndIf
Case "+"
If $next[0] > $width2 - $bsize AND $next[0] < $width2 + $padw Then
If $next[1] > ($pad2[1] - $bsize * 2) AND $next[1] < ($pad2[1] + $padh) Then
Sign("x")
$maxa = $maxa + Random(0, 1, 1)
$speed[0] = $speed[0] + Random(0, 1, 1)
$speed[1] = Random(1, $maxa, 1)
$hits = $hits + 1
EndIf
EndIf
EndSwitch -
Hallo,
Bin jetzt beim Ball, hab keine Ahnung wie ich den jetzt Diagonal fliegen lasse
( und was muss ich machen damit er die 0 nicht übermalen kann? )Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]
Global $BewegungSenkrecht=5
Global $ballpos1 = @DesktopWidth/2
Global $ballpos2 = @DesktopHeight/2-50
Global $Strichpos1 = @DesktopHeight / 2 - 70
Global $Strichpos2 = @DesktopHeight / 2 + 70
Global $RStrichpos1 = @DesktopHeight / 2 - 70
Global $RStrichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong"
Global $Rahmenbreite = 10
Global $dll = DllOpen("user32.dll")
_GDIPlus_Startup()
;~ $WS_EX_COMPOSITED = 0x2000000
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0));$WS_EX_COMPOSITED))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUISetState(@SW_SHOW)Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(100)
Until _IsPressed("0D", $dll) Or _IsPressed("20", $dll)GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
$hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
$hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
$hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()
$Spielstand = GUICtrlCreateLabel("0:0", @DesktopWidth / 2, @DesktopHeight / 15, 100, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit]Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GuiSetAccelerators($accel)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitEndSwitch
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_endeFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
EndFunc ;==>_DrawRahmenFunc _Zyklus()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
_ball()
If _DetectCollision()=1 Then
_Abprallen(1)
ElseIf _DetectCollision()=2 Then
_Abprallen(2)
EndIf
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - 10, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= 10
$Strichpos2 -= 10
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + 10, $hpen_Del)
$Strichpos1 += 10
$Strichpos2 += 10
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos2 - 10, @DesktopWidth - 100, $RStrichpos2, $hpen_Del)
$RStrichpos1 -= 10
$RStrichpos2 -= 10
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter2()
[/autoit] [autoit][/autoit] [autoit]
If $RStrichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos1 + 10, $hpen_Del)
$RStrichpos1 += 10
$RStrichpos2 += 10
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $RStrichpos1, @DesktopWidth - 100, $RStrichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _ball()
[/autoit] [autoit][/autoit] [autoit]
$ball=_GDIPlus_GraphicsDrawArc ($hGraphic,$ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
$ball=_GDIPlus_GraphicsDrawArc ($hGraphic,$ballpos1, $ballpos2, 15, 15, 180, 360, $hpen_Del)
$ballpos2+=$BewegungSenkrecht
$ball=_GDIPlus_GraphicsDrawArc ($hGraphic,$ballpos1, $ballpos2, 15, 15, 180, 360, $hPen)
EndFuncFunc _DetectCollision()
[/autoit] [autoit][/autoit] [autoit]
If $ballpos2=@DesktopHeight-35 Then
Return 1
ElseIf $ballpos2=35 Then
Return 2
EndIf
EndFuncFunc _Abprallen($number)
[/autoit]
If $number=1 Then
$BewegungSenkrecht=-5
ElseIf $number=2 Then
$BewegungSenkrecht=+5
EndIf
EndFunc -
[autoit]
Func IsVisible($handle)
[/autoit]
Return BitAND(WinGetState($handle), 2)
EndFunc ;==>IsVisibleGeht das nicht?
-
Obfuscator soll das dekompilieren verhindern.
Und mann kann auch Version 3 Scripte dekompilieren ( ist aber nicht erlaubt ).
-
Spoiler anzeigen
[autoit]#include <GDIPlus.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>HotKeySet("{ESC}", "_ende")
[/autoit] [autoit][/autoit] [autoit]
Global $Strichpos1 = @DesktopHeight / 2 - 70
Global $Strichpos2 = @DesktopHeight / 2 + 70
Global $Titel = "Pong"
Global $Rahmenbreite = 10
Global $dll = DllOpen("user32.dll")
_GDIPlus_Startup()
;~ $WS_EX_COMPOSITED = 0x2000000
Global $hGUI = GUICreate($Titel, @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_TOPMOST, 0x0));$WS_EX_COMPOSITED))
Global $hwnd = WinGetHandle($Titel)
GUISetBkColor(0x0)
$Willkommen = GUICtrlCreateLabel("Willkommen bei Pong made by Greek", @DesktopWidth / 4, @DesktopHeight / 2 - 150, 1000, 200)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)
GUISetState(@SW_SHOW)Do
[/autoit] [autoit][/autoit] [autoit]
Sleep(100)
Until _IsPressed("0D", $dll) Or _IsPressed("20", $dll)GUICtrlSetState($Willkommen, $GUI_HIDE)
[/autoit] [autoit][/autoit] [autoit]$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hwnd)
[/autoit] [autoit][/autoit] [autoit]
$hPenRahmen = _GDIPlus_PenCreate(0xFF0000FF, 15, 2)
$hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 15, 2)
$hpen_Del = _GDIPlus_PenCreate(0xFF000000, 15, 2)
$b = _GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
_DrawRahmen()
$Spielstand = GUICtrlCreateLabel("0:0", @DesktopWidth / 2, @DesktopHeight / 15, 100, 100)
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 40)AdlibEnable('_Zyklus', 10)
[/autoit] [autoit][/autoit] [autoit]Local $accel[4][2] = [["w"],["s"],["{UP}"],["{DOWN}"]]
[/autoit] [autoit][/autoit] [autoit]
GuiSetAccelerators($accel)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitEndSwitch
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
WEndFunc _ende()
[/autoit] [autoit][/autoit] [autoit]
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_endeFunc _DrawRahmen()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
_GDIPlus_GraphicsDrawLine($hGraphic, $Rahmenbreite / 2, 0, $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, $Rahmenbreite / 2, @DesktopWidth, $Rahmenbreite / 2, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - $Rahmenbreite / 2, 0, @DesktopWidth - $Rahmenbreite / 2, @DesktopHeight, $hPenRahmen)
_GDIPlus_GraphicsDrawLine($hGraphic, 0, @DesktopHeight - $Rahmenbreite / 2, @DesktopWidth, @DesktopHeight - $Rahmenbreite / 2, $hPenRahmen)
EndFunc ;==>_DrawRahmenFunc _Zyklus()
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
If _IsPressed('57') Then
_hoch()
ElseIf _IsPressed('53') Then
_runter()
ElseIf _IsPressed('26') Then
_hoch2()
ElseIf _IsPressed('28') Then
_runter2()
EndIf
;Hier müssen noch die restlichen Aktionen rein
EndFunc ;==>_ZyklusFunc _hoch()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos2 - 10, 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= 10
$Strichpos2 -= 10
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos1 + 10, $hpen_Del)
$Strichpos1 += 10
$Strichpos2 += 10
_GDIPlus_GraphicsDrawLine($hGraphic, 100, $Strichpos1, 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterFunc _hoch2()
[/autoit] [autoit][/autoit] [autoit]
If $Strichpos1 >= 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos2 - 10, @DesktopWidth - 100, $Strichpos2, $hpen_Del)
$Strichpos1 -= 10
$Strichpos2 -= 10
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_hochFunc _runter2()
[/autoit]
If $Strichpos2 <= @DesktopHeight - 25 Then
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos1 + 10, $hpen_Del)
$Strichpos1 += 10
$Strichpos2 += 10
_GDIPlus_GraphicsDrawLine($hGraphic, @DesktopWidth - 100, $Strichpos1, @DesktopWidth - 100, $Strichpos2, $hPen)
EndIf
EndFunc ;==>_runterWenn man beide Beweget ist es Total verbuggt, an was könnte das liegen?
Edit: Ah ich glaub es liegt am Variablen Name Strickposition, die dürfen ja net gleich heißen, mom ausprobieren.
Edit2: Ja lag an der Variable, aber man kann trotzdem nicht beide gleichzeitig drücken, es kann immer nur einer lenken.
Edit3:
[autoit]Func _Zyklus()
[/autoit]
If _IsPressed('57') Then
_hoch()
EndIf
If _IsPressed('53') Then
_runter()
EndIf
If _IsPressed('26') Then
_hoch2()
EndIf
If _IsPressed('28') Then
_runter2()
EndIf
;Hier müssen noch die restlichen Aktionen rein
EndFunc ;==>_ZyklusSo funzt endlich alles, danke an alle die mir Geholfen haben!! =D
-
Ah Funktioniert Perfekt, vielen Dank =D
Ashpool
HotKeySet( "w", "_hochL" )
HotKeySet( "s", "_runterL" )
HotKeySet( "{UP}", "_hochR" )
HotKeySet( "{DOWN}", "_runterR" )Sind doch garnicht die selben Tasten, oder wie meinst du das?