#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/striponly
#include <GDIPlus.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <timers.au3>
#include <sound.au3>
#include <inet.au3>
#include <array.au3>

$Width = 300
$Height = 460

$JumpSpeed = 0.15
$JumpHeight = 80 ;Pixel
$MoveSpeed = 0
$Zeitschrit = 0.2



;==================== Hotkeyset, Gui, Eventmode
HotKeySet("{PAUSE}", "_pause")

$GUI1 = GUICreate("Doodle Jump - Beta", $Width, $Height)
GUISetState(@SW_SHOW)

opt("guioneventmode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "ende")
AutoItSetOption ("MouseCoordMode", 0)

;==================== Sound
$sPropeller = _SoundOpen(@ScriptDir&"\Sounds\propeller.wav")
$sFall = _SoundOpen(@ScriptDir&"\Sounds\falldown.wav")
$sJump = _SoundOpen(@ScriptDir&"\Sounds\Jump.wav")
$sRakete = _SoundOpen(@ScriptDir&"\Sounds\Jetpack.wav")
$sSprung = _SoundOpen(@ScriptDir&"\Sounds\Feder.wav")



;=========================== Gdi+ Grafik vorbereiten
_GDIPlus_Startup()
$Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI1)
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $Graphic)
$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

;=========================== gleichbleibende Bilder
$Rakete = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Rakete.gif")
$Newhighscore = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Newhighscore.gif")
$Gameover = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Gameover.gif")
$Scorebackground = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\scorebackground.gif")
$Hut = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Hut.gif")
$Schwarz = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Bildschwarz.gif")
$Pausebild = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Paused.gif")
$Optionscreen = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Optionen.gif")
$Federzu = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Feder zu.gif")
$Federoffen = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Feder offen.gif")
$Federz_Height = _GDIPlus_ImageGetHeight($Federzu)
$Federo_Height = _GDIPlus_ImageGetHeight($Federoffen)

;=========================== normale Bilder
$nBackground = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\background.gif")
$nStart = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Start1.gif")
$nDoodleHutl = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Links k.gif")
$nDoodleHutr = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Rechts k.gif")
$nDoodleHutl1 = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Links l.gif")
$nDoodleHutr1 = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Rechts l.gif")
$nPunkteleiste = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Punkteleiste.gif")
$nPlatform_gruen =_GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Platform grün.gif")
$nPlatform_hellblau = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Platform hellblau.gif")
$nDoodle_Rechts =_GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Rechts e.png")
$nDoodle_Links = _GDIPlus_ImageLoadFromFile (@ScriptDir&"\Bilder\Doodle_Links e.png")
$nDoodle_Height = _GDIPlus_ImageGetHeight($nDoodle_Rechts)
$nDoodle_Width = _GDIPlus_ImageGetWidth($nDoodle_Rechts)
$nPlat_Width = _GDIPlus_ImageGetWidth($nPlatform_gruen)
$nDoodleRakl = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Rakete l.gif")
$nDoodleRakr = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Rakete r.gif")


;=========================== Winter Bilder
$wBackground = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\background winter.gif")
$wStart = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Start.gif")
$wDoodleHutl = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle ll.gif")
$wDoodleHutr = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle rl.gif")
$wDoodleHutl1 = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle lk.gif")
$wDoodleHutr1 = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle rk.gif")
$wPunkteleiste = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Punkteleiste.gif")
$wPlatform_gruen =_GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter gruen.gif")
$wPlatform_hellblau = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter gruen.gif")
$wDoodle_Rechts =_GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle re.gif")
$wDoodle_Links = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle l.gif")
$wDoodle_Height = _GDIPlus_ImageGetHeight($wDoodle_Rechts)
$wDoodle_Width = _GDIPlus_ImageGetWidth($wDoodle_Rechts)
$wPlat_Width = _GDIPlus_ImageGetWidth($wPlatform_gruen)
$wDoodleRakl = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle rakete l.gif")
$wDoodleRakr = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Winter Doodle rakete r.gif")
$wFederzu = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Feder zu.gif")
$wFederoffen = _GDIPlus_ImageLoadFromFile (@ScriptDir & "\Bilder\Feder offen.gif")


;============================= für Optionstext
$hFormat = _GDIPlus_StringFormatCreate ()
$hFamily = _GDIPlus_FontFamilyCreate ("Comic Sans MS")
$hFont = _GDIPlus_FontCreate ($hFamily, 11, 1)
$tLayout1 = _GDIPlus_RectFCreate (44, 134, 0, 0)
$tLayout2 = _GDIPlus_RectFCreate (115, 134, 0, 0)
$tLayout3 = _GDIPlus_RectFCreate (49, 252, 0, 0)
$tLayout4 = _GDIPlus_RectFCreate (120, 252, 0, 0)
$aInfo1 = _GDIPlus_GraphicsMeasureString ($Buffer, "mouse", $hFont, $tLayout1, $hFormat)
$aInfo2 = _GDIPlus_GraphicsMeasureString ($Buffer, "arrow keys", $hFont, $tLayout2, $hFormat)
$aInfo3 = _GDIPlus_GraphicsMeasureString ($Buffer, "on", $hFont, $tLayout3, $hFormat)
$aInfo4 = _GDIPlus_GraphicsMeasureString ($Buffer, "off", $hFont, $tLayout4, $hFormat)

;===================== Var Deklarierung
Global $ReadS[5], $ReadN[5], $gruen_n[13][4], $datapath = @ScriptDir & "\Scores.ini", $optioncoloron = 0xff7CB639, $optioncoloroff = 0xffABA69F, $hutt = 3, $tnorm, $grav = 9.81, $sprung = 0, $sprungkraft = 50
Global $Background, $Start,$DoodleHutl,$DoodleHutr,$DoodleHutl1,$DoodleHutr1,$Punkteleiste,$Platform_gruen,$Platform_hellblau, $AktuellerDoodle, _
		$Doodle_Rechts,$Doodle_Links,$Doodle_Height,$Doodle_Width,$Plat_Width,$DoodleRakl,$DoodleRakr
Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $i = 0, $t = 0, $x = $gruen_n[0][0], $y  = 380 - $Doodle_Height, _
$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0, $wintermod = IniRead($datapath, "Optionen", "Wintermode", "0")
Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move =0, $score = 0, $scoreplus = 0, $yboden = $gruen_n[0][1], $Platmovespeed = 0, $platten = 0, $huton = 0, $timeron = 0, $dll=DllOpen("user32.dll")



Global $bewegrichtung[17] = [Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1 , 1), _
Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), _
Random(0, 1 , 1), Random(0, 1, 1), Random(0, 1, 1)]

For $n = 0 to UBound($gruen_n)-1
$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
$gruen_n[$n][1] = 400 - ($n * 60)
$gruen_n[$n][2] = 0
$gruen_n[$n][3] = 0
Next

;==================== Inireads
	$wintermod = IniRead($datapath, "Optionen", "Wintermode", "0")
	$movement = Iniread($datapath, "Optionen", "movement", "0")
	$soundoff = Iniread($datapath, "Optionen", "soundoff", "0")
	$ReadS[0] = Iniread($datapath, "Scores", "1", "")
	$ReadS[1] = Iniread($datapath, "Scores", "2", "")
	$ReadS[2] = Iniread($datapath, "Scores", "3", "")
	$ReadS[3] = Iniread($datapath, "Scores", "4", "")
	$ReadS[4] = Iniread($datapath, "Scores", "5", "")

	$ReadN[0] = Iniread($datapath, "Names", "1", "")
	$ReadN[1] = Iniread($datapath, "Names", "2", "")
	$ReadN[2] = Iniread($datapath, "Names", "3", "")
	$ReadN[3] = Iniread($datapath, "Names", "4", "")
	$ReadN[4] = Iniread($datapath, "Names", "5", "")


;============================= für Optionstextfarbe
If $movement = 0 Then
$hBrush1 = _GDIPlus_BrushCreateSolid (0xff7CB639)
$hBrush2 = _GDIPlus_BrushCreateSolid (0xffABA69F)
Else
$hBrush2 = _GDIPlus_BrushCreateSolid (0xff7CB639)
$hBrush1 = _GDIPlus_BrushCreateSolid (0xffABA69F)
EndIf
If $soundoff = 0 Then
$hBrush3 = _GDIPlus_BrushCreateSolid (0xff7CB639)
$hBrush4 = _GDIPlus_BrushCreateSolid (0xffABA69F)
Else
$hBrush4 = _GDIPlus_BrushCreateSolid (0xff7CB639)
$hBrush3 = _GDIPlus_BrushCreateSolid (0xffABA69F)
Endif



;============================= Winter on/off
If $wintermod = 1 Then
_winter()
$AktuellerDoodle = $wDoodle_Rechts
Else
_winteroff()
$AktuellerDoodle = $nDoodle_Rechts
EndIf

_Start()

While 1
	If $paused = 1 Then
		_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Schwarz, 0, 0, "", "", "", "", "" , "", 2, 50)
		_GDIPlus_GraphicsDrawImage($Buffer, $Pausebild, $Width/2 -64, $Height/2 - 37.5)
		Do
			Sleep(50)
			 _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)

		Until $paused = 0
	EndIf
If $y -5 > $Height Then $die = True

If $die = False Then
	iF WinActive("[active]") = $GUI1 Then
	Redraw()
	Endif
	$soundplayed = 0
	Elseif $scoreplus > $ReadS[4] Then
	Newscore()
	Elseif $scoreplus < $ReadS[4] Then
		Dead()
	EndIf
WEnd






Func Redraw()
	If $movement = 0 Then
		$aktualpos = MouseGetPos()
		If  $aktualpos[0] < $Width /2  Then
			$MoveSpeed = ($aktualpos[0] -  $Width /2)/3
			Select
				Case $huton = 0 and $raketeon = 0
					$AktuellerDoodle = $Doodle_Links
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakl
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutl
			EndSelect


		EndIf
		If  $aktualpos[0] >  $Width /2 Then
			$MoveSpeed =  ($aktualpos[0] -  $Width /2)/3
			Select
				Case $huton = 0 and $raketeon = 0
					$AktuellerDoodle = $Doodle_Rechts
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakr
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutr
			EndSelect
		EndIf
	Else
		If  _IsPressed("25",$dll) Then
			$MoveSpeed -= 2
			Select
				Case $huton = 0 and $raketeon = 0
					$AktuellerDoodle = $Doodle_Links
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakl
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutl
			EndSelect
		EndIf
		If  _IsPressed("27",$dll) Then
			$MoveSpeed += 2
			Select
				Case $huton = 0 and $raketeon = 0
					$AktuellerDoodle = $Doodle_Rechts
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakr
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutr
			EndSelect
		EndIf
		EndIf
	Select
		Case $x + $Doodle_Width < 0
			$x = $Width
		Case $x > $Width
			$x = $Doodle_Width * -1
		Case $MoveSpeed > 30
			$MoveSpeed =30
		Case $MoveSpeed < -30
			$MoveSpeed = -30
	EndSelect
		$i += $JumpSpeed



$platnotactive = 0
$platactive = 0
$yalt = $y
$platold = $plat
If $huton = 0 and $raketeon = 0 Then
	$t += $Zeitschrit
	If $wintermod = 1 Then
If $yboden= $y +30 Then
	$y = $yboden  - $Doodle_Height - Round (Abs($sprungkraft*$t-($grav/2)*$t^2))
	Else
$y = $yboden  - $Doodle_Height - Round ($sprungkraft*$t-($grav/2)*$t^2)
EndIf
Else
If $yboden= $y +30 Then
	$y = $yboden  - $Doodle_Height -10 - Round (Abs($sprungkraft*$t-($grav/2)*$t^2))
	Else
$y = $yboden  - $Doodle_Height -10 - Round ($sprungkraft*$t-($grav/2)*$t^2)
EndIf
EndIf

$ybodenalt = $yboden
If $huton = 0 and $raketeon = 0 Then
For $n = 0 to UBound($gruen_n, 1)-1 Step 1

	Select
		Case $y < 0
			$Platmovespeed= 10

		Case $y < 220 and $y > 180
			$move = 1
			$Platmovespeed = 1

		Case $y < 180
			$Platmovespeed= 4
		Case $y > 180
			$Platmovespeed = 0
		Case $y >= 220
			$move = 0
			$Platmovespeed = 0
Endselect
Select
	Case  ($gruen_n[$n][0] - $Doodle_Width <= $x and $gruen_n[$n][0] + $Plat_Width >= $x) and($y+$Doodle_Height<=$gruen_n[$n][1] and $y+$Doodle_Height+15>=$gruen_n[$n][1])
		If $yalt < $y Then


		$onplatform = 1
		$plat = $n
		$t = 0
		$t = $Zeitschrit
		$yboden = $gruen_n[$n][1]
		$platten +=1
		If $platold < $plat or ($platold = 16 and $plat = 0) Then
		$scoreplus +=100
	EndIf
		If $gruen_n[$n][3] = 1 Then
			If $AktuellerDoodle = $Doodle_Links Then
				$AktuellerDoodle = $DoodleHutl
			Else
				$AktuellerDoodle = $DoodleHutr
			EndIf
			$gruen_n[$n][3] = 0
			$huton = 1
		EndIf
		If $gruen_n[$n][3] = 2 Then
			If $AktuellerDoodle = $Doodle_Rechts Then
				$AktuellerDoodle = $DoodleRakr
			Else
				$AktuellerDoodle = $DoodleRakl
			EndIf
			$gruen_n[$n][3] = 0
			$raketeon = 1
		EndIf
		If $sprung = 1 Then
			$sprung = 0
			$sprungkraft /= 2
		EndIf

		If $gruen_n[$n][3] = 3 Then
			If $gruen_n[$n][0] + 17 >= $x Then
			If $soundoff = 0 Then _SoundPlay($sSprung)
			$gruen_n[$n][3] = 4
			$sprung = 1
			$sprungkraft *= 2
			EndIf
		EndIf
If $soundoff = 0 and $sprung = 0 Then _SoundPlay($sJump)
	EndIf


EndSelect
Next
EndIf
Endif

;~ For $n = 0 to Ubound(

$x += $MoveSpeed*$t/10
If $raketeon = 0 and $huton = 0 Then
If $ybodenalt > $yboden Then $scoreplus += Abs(($yboden - $ybodenalt))
EndIf
;~
If $y + 5 > $Height Then
;~ 	MsgBox(0, "", $yboden)
	$die = True
EndIf



If $huton = 1 Then
	$plus = 15
ElseIf $raketeon = 1 Then
	$plus = 30
Else
	$plus = 10
EndIf


If  $scoreplus > $score Then
	$score += $plus
	Elseif (not $scoreplus/10 = Round($scoreplus/10)*10) Then
	$score += $scoreplus - Round($scoreplus/10)*10
EndIf


;======================HUT
If $huton = 1 Then

	If $timeron = 0 Then
	If $soundoff = 0 Then _SoundPlay($sPropeller, 0)
	$scoreplus += 1500
	$huttimer = _Timer_Init()
	$timeron = 1
	$tnorm = $t
	$t = $hutt
	EndIf
	$Platmovespeed = 6
	$time = _Timer_Diff($huttimer)

	If $hutbild = 0 Then
		If $AktuellerDoodle = $DoodleHutl Then
			$AktuellerDoodle = $DoodleHutl1
		ElseIf $AktuellerDoodle = $DoodleHutr Then
			$AktuellerDoodle = $DoodleHutr1

		EndIf
		$hutbild = 1
	Else
		If $AktuellerDoodle = $DoodleHutl1 Then
			$AktuellerDoodle = $DoodleHutl
		ElseIf $AktuellerDoodle = $DoodleHutr1 Then
			$AktuellerDoodle = $DoodleHutr
		EndIf
		$hutbild = 0
	EndIf



	If  $time >= 3000 Then
		$t = $tnorm
		$huton = 0
		$timeron = 0
		If $AktuellerDoodle = $DoodleHutr Then
			$AktuellerDoodle = $Doodle_Rechts
			Else
			$AktuellerDoodle = $Doodle_Links
			EndIf

	EndIf
EndIf



;=========================Rakete
If $raketeon = 1 Then

	If $timerrakon = 0 Then
	If $soundoff = 0 Then _SoundPlay($sRakete, 0)
	$scoreplus += 3000
	$raketentimer = _Timer_Init()
	$timerrakon = 1
	$tnorm = $t
	$t = $hutt
	If $AktuellerDoodle = $Doodle_Rechts Then
			$AktuellerDoodle = $DoodleRakr
		Else
			$AktuellerDoodle = $DoodleRakl
		EndIf
	EndIf
	$Platmovespeed = 15
	$time = _Timer_Diff($raketentimer)




	If  $time >= 3000 Then
		$raketeon = 0
		$timerrakon = 0
		$t = $tnorm
		If $AktuellerDoodle = $DoodleRakr Then
			$AktuellerDoodle = $Doodle_Rechts
		Else
			$AktuellerDoodle = $Doodle_Links
		EndIf

	EndIf
EndIf







If $move = 1 then
	If $huton = 0 and $raketeon = 0 Then
	$yboden += $Platmovespeed
	Endif
		For $n = 0 to UBound($gruen_n)-1
		$gruen_n[$n][1] += $Platmovespeed
		If $gruen_n[$n][2] = 1 Then
		Select
			Case $gruen_n[$n][0] <=30
				$bewegrichtung[$n] = 1
			Case $gruen_n[$n][0] + $Plat_Width >= $Width - 30
				$bewegrichtung[$n] = 0
		EndSelect

		If $bewegrichtung[$n] = 1 Then
			$gruen_n[$n][0] += 3
		Else
			$gruen_n[$n][0] -= 3
		Endif
	EndIf

		If $gruen_n[$n][1] > $Height Then
			reset($n)
		EndIf



	Next

Endif

;~ MsgBox(0, "", $MoveSpeed)

;~     _GDIPlus_GraphicsClear($Buffer, 0xFFFFFFFF)
	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
    _GDIPlus_GraphicsDrawImage ($Buffer, $Background, 0, 0)
    _GDIPlus_GraphicsDrawImage ($Buffer, $AktuellerDoodle, $x, $y)



If $wintermod = 1 Then
	For $n = 0 to UBound($gruen_n, 1)-1
		Switch $gruen_n[$n][3]
			Case 1
			_GDIPlus_GraphicsDrawImage ($Buffer, $Hut, $gruen_n[$n][0], $gruen_n[$n][1]-23 - 10)
			Case 2
			_GDIPlus_GraphicsDrawImage ($Buffer, $Rakete, $gruen_n[$n][0], $gruen_n[$n][1]-37 - 10)
			Case 3
			_GDIPlus_GraphicsDrawImage ($Buffer, $Federzu, $gruen_n[$n][0], $gruen_n[$n][1]-$Federz_Height - 10)
			Case 4
			_GDIPlus_GraphicsDrawImage ($Buffer, $Federoffen, $gruen_n[$n][0], $gruen_n[$n][1]-$Federo_Height - 10)
		EndSwitch

	Switch $gruen_n[$n][2]
		Case 0
		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_gruen, $gruen_n[$n][0], $gruen_n[$n][1]- 10)
		Case 1
		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_hellblau, $gruen_n[$n][0], $gruen_n[$n][1]- 10)
;~ 	Case 2
;~ 		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_weis, $gruen_n[$n][0], $gruen_n[$n][1])
;~ 		$weisx = $gruen_n[1][0]
;~ 		$weisy = $gruen_n[$n][1]
;~ 		_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_weis, $weisx, $weisx, "", "", "", "", "" , "", 2, 50)

EndSwitch
Next
Else
For $n = 0 to UBound($gruen_n, 1)-1
		Switch $gruen_n[$n][3]
			Case 1
			_GDIPlus_GraphicsDrawImage ($Buffer, $Hut, $gruen_n[$n][0], $gruen_n[$n][1]-23)
			Case 2
			_GDIPlus_GraphicsDrawImage ($Buffer, $Rakete, $gruen_n[$n][0], $gruen_n[$n][1]-37)
			Case 3
			_GDIPlus_GraphicsDrawImage ($Buffer, $Federzu, $gruen_n[$n][0], $gruen_n[$n][1]-$Federz_Height)
			Case 4
			_GDIPlus_GraphicsDrawImage ($Buffer, $Federoffen, $gruen_n[$n][0], $gruen_n[$n][1]-$Federo_Height)
	EndSwitch

	Switch $gruen_n[$n][2]
		Case 0
		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_gruen, $gruen_n[$n][0], $gruen_n[$n][1])
		Case 1
		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_hellblau, $gruen_n[$n][0], $gruen_n[$n][1])
	Case 2
;~ 		_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_weis, $gruen_n[$n][0], $gruen_n[$n][1])
;~ 		$weisx = $gruen_n[1][0]
;~ 		$weisy = $gruen_n[$n][1]
;~ 		_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_weis, $weisx, $weisx, "", "", "", "", "" , "", 2, 50)

EndSwitch

Next
EndIf

	$x1 = 0
	$y1 = 0
	_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Punkteleiste, $x1, $y1, "", "", "", "", "" , "", 2, 50)
	_GDIPlus_GraphicsDrawString($Buffer, Round($score,0) , 5, 5, "Comic Sans MS", 15)
    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
    Sleep(20)

EndFunc
;====================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================




Func reset($n)
	$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	If $n = 0 Then
		$gruen_n[$n][1] = $gruen_n[UBound($gruen_n) - 1][1]+$abstand
	Else
		$gruen_n[$n][1] = $gruen_n[$n - 1][1]+$abstand
		EndIf
	If $scoreplus > 2000 Then
		EndIf

		If $scoreplus > 10000 Then
			If $scoreplus > 30000 Then
				$r = Random(0, 1, 1)
			Else

			$r = Random(0, 3, 1)
		EndIf

		Else
			$r = Random(0, 10, 1)
		Endif
	If $r = 1 Then
		$gruen_n[$n][2] = 1
	Else
		$gruen_n[$n][2] = 0
	EndIf
	If $scoreplus >= $punktelimit then
		$abstand -= 3
		$punktelimit = $punktelimit + ($punktelimit + 1000)
	Endif

If $gruen_n[$n][3] = 4 Then $gruen_n[$n][3] = 0
$r = Random(0, 100, 1)
If $r = 3 Then $gruen_n[$n][3] = 1
If $r = 6 Then $gruen_n[$n][3] = 2
$r = Random(0, 50, 1)
If $r = 3 Then $gruen_n[$n][3] = 3

;============== $gruen_n[$n][3] = 4 <== wird gebraucht Nicht benutzen!

EndFunc



Func _GDIPlus_GraphicsDrawImageRectRectTrans($hGraphics, $hImage, $iSrcX, $iSrcY, $iSrcWidth = "", $iSrcHeight = "", _
    $iDstX = "", $iDstY = "", $iDstWidth = "" , $iDstHeight = "", $iUnit = 2, $nTrans = 1)
    Local $tColorMatrix, $x, $hImgAttrib, $iW = _GDIPlus_ImageGetWidth($hImage), $iH = _GDIPlus_ImageGetHeight($hImage)
    If $iSrcWidth = 0 or $iSrcWidth = "" Then $iSrcWidth = $iW
    If $iSrcHeight = 0 or $iSrcHeight = "" Then $iSrcHeight = $iH
    If $iDstX = "" Then $iDstX = $iSrcX
    If $iDstY = "" Then $iDstY = $iSrcY
    If $iDstWidth = "" Then $iDstWidth = $iSrcWidth
    If $iDstHeight = "" Then $iDstHeight = $iSrcHeight
    If $iUnit = "" Then $iUnit = 2
    ;;create color matrix data
    $tColorMatrix = DllStructCreate("float[5];float[5];float[5];float[5];float[5]")
    ;blending values:
    $x = DllStructSetData($tColorMatrix, 1, 1, 1) * DllStructSetData($tColorMatrix, 2, 1, 2) * DllStructSetData($tColorMatrix, 3, 1, 3) * _
            DllStructSetData($tColorMatrix, 4, $nTrans, 4) * DllStructSetData($tColorMatrix, 5, 1, 5)
    ;;create an image attributes object and update its color matrix
    $hImgAttrib =  DllCall($ghGDIPDll, "int", "GdipCreateImageAttributes", "ptr*", 0)
    $hImgAttrib = $hImgAttrib[1]
     DllCall($ghGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, _
            "int", 1, "ptr", DllStructGetPtr($tColorMatrix), "ptr", 0, "int", 0)
    ;;draw image into graphic object with alpha blend
    DllCall($ghGDIPDll, "int", "GdipDrawImageRectRectI", "hwnd", $hGraphics, "hwnd", $hImage, "int", $iDstX, "int", _
            $iDstY, "int", $iDstWidth, "int", $iDstHeight, "int", $iSrcX, "int", $iSrcY, "int", $iSrcWidth, "int", _
            $iSrcHeight, "int", $iUnit, "ptr", $hImgAttrib, "int", 0, "int", 0)
    ;;clean up
    DllCall($ghGDIPDll, "int", "GdipDisposeImageAttributes", "ptr", $hImgAttrib)
    Return
EndFunc   ;==>_GDIPlus_GraphicsDrawImageRectRectTrans


Func _Start()
;~ 	MsgBox(0,"","")
	While 2
;~ 	$Label = GUICtrlCreateLabel("", 53, 149, 110, 41)
;~ 	GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)

	If WinActive("[active]") = $GUI1 Then
	Select
		case _IsPressed("01")
			$pos = MouseGetPos()
			;MsgBox(0,$pos[0],$pos[1])
		Select
			Case $pos[0] > 155 and $pos[0] < 268 and $pos[1] > 318 and $pos[1] < 358
				_optionen()

			Case $pos[0] > 50 and $pos[0] < 153 and $pos[1] > 145 and $pos[1] < 182

				Global $ReadS[5], $ReadN[5], $gruen_n[13][4], $datapath = @ScriptDir & "\Scores.ini", $optioncoloron = 0xff7CB639, $optioncoloroff = 0xffABA69F
				Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $t = 0, $x = $gruen_n[0][0], $y  = 380 - $Doodle_Height, $yboden = $gruen_n[0][1], _
				$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0, $wintermod = IniRead($datapath, "Optionen", "Wintermode", "0")
				Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move =0, $score = 0, $scoreplus = 0, $yboden = $gruen_n[0][1], $Platmovespeed = 0, $platten = 0, $huton = 0, $timeron = 0, $dll=DllOpen("user32.dll")

				Global $bewegrichtung[17] = [Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1 , 1), _
				Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), Random(0, 1, 1), _
				Random(0, 1 , 1), Random(0, 1, 1), Random(0, 1, 1)]


				For $n = 0 to UBound($gruen_n)-1
					$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
					$gruen_n[$n][1] = 400 + ($n * $abstand)
					$gruen_n[$n][2] = 0
					$gruen_n[$n][3] = 0
				Next

				$x = $gruen_n[0][0]
				$y  = 380 - $Doodle_Height
				$yboden = $gruen_n[0][1]
				$die = False
				$t = 0
				$plat = 0
				$MoveSpeed = 0
				$move =0
				$Platmovespeed = 0
				$platten = 0
				$score = 0
				$scoreplus = 0
ExitLoop

			Case $pos[0] > 79 and $pos[0] < 185 and $pos[1] > 202 and $pos[1] < 240
				_Showscore()
				ExitLoop

			Case $pos[0] > 188 And $pos[0] < 216 And $pos[1] > 446 And $pos[1] < 467
				_winteroff()
			Case $pos[0] > 245 And $pos[0] < 272 And $pos[1] > 416 And $pos[1] < 436
				_winter()




		EndSelect
	EndSelect
	EndIf


		 $y1 = 400  - $Doodle_Height - Round (Abs(Sin($i))*$JumpHeight)
		$x1 = 60
	$i += $JumpSpeed
	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)



	_GDIPlus_GraphicsDrawImage ($Buffer, $Start, 0, 0)
    _GDIPlus_GraphicsDrawImage ($Buffer, $Doodle_Rechts, $x1, $y1)
	_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_gruen, 50, 400)

    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
	Sleep(20)
	Wend
EndFunc ;==> Start




Func _optionen()
	If FileExists($datapath) Then

	EndIf
;~ 	MsgBox(0, "", $ReadS[0])
	While 3
	 $y = 400  - $Doodle_Height - 10 - Round (Abs(Sin($i))*$JumpHeight)
		$x = 60
	$i += $JumpSpeed

	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
	_GDIPlus_GraphicsDrawImage($Buffer, $Optionscreen, 0, 0)

	_GDIPlus_GraphicsDrawStringEx ($Buffer, "mouse", $hFont, $aInfo1[0], $hFormat, $hBrush1)
	_GDIPlus_GraphicsDrawStringEx ($Buffer, "arrow keys", $hFont, $aInfo2[0], $hFormat, $hBrush2)
	_GDIPlus_GraphicsDrawStringEx ($Buffer, "on", $hFont, $aInfo3[0], $hFormat, $hBrush3)
	_GDIPlus_GraphicsDrawStringEx ($Buffer, "off", $hFont, $aInfo4[0], $hFormat, $hBrush4)


    _GDIPlus_GraphicsDrawImage ($Buffer, $Doodle_Rechts, $x, $y)
	_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_gruen, 50, 400)
    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
	Sleep(20)
	If WinActive("[active]") = $GUI1 Then
	$pos = MouseGetPos()
    Select
		Case _IsPressed("01", $dll)
			IF $pos[0] > 184 and $pos[0] < 293 and $pos[1] > 389 and $pos[1] < 430 Then
				_Start()
				IniWrite($datapath, "Optionen", "movement", $movement)
				IniWrite($datapath, "Optionen", "soundoff", $soundoff)
				ExitLoop
			EndIf

			IF $pos[0] > 47 and $pos[0] < 92 and $pos[1] > 165 and $pos[1] < 175 Then
				_GDIPlus_BrushSetSolidColor($hBrush1, $optioncoloron)
				_GDIPlus_BrushSetSolidColor($hBrush2, $optioncoloroff)
				$movement = 0
			EndIf
			IF $pos[0] > 118 and $pos[0] < 198 and $pos[1] > 165 and $pos[1] < 175 Then
				_GDIPlus_BrushSetSolidColor($hBrush1, $optioncoloroff)
				_GDIPlus_BrushSetSolidColor($hBrush2, $optioncoloron)
				$movement = 1
			EndIf
			IF $pos[0] > 53 and $pos[0] < 71 and $pos[1] > 284 and $pos[1] < 293 Then
				_GDIPlus_BrushSetSolidColor($hBrush3, $optioncoloron)
				_GDIPlus_BrushSetSolidColor($hBrush4, $optioncoloroff)
				$soundoff = 0
			EndIf
			IF $pos[0] > 125 and $pos[0] < 149 and $pos[1] > 279 and $pos[1] < 293 Then
				_GDIPlus_BrushSetSolidColor($hBrush3, $optioncoloroff)
				_GDIPlus_BrushSetSolidColor($hBrush4, $optioncoloron)
				$soundoff = 1
			EndIf
	EndSelect
	EndIf
Wend
EndFunc




Func _Showscore()
;~ 	MsgBox(0, "", "")

	If FileExists($datapath) Then
		$ReadS[0] = Iniread($datapath, "Scores", "1", "")
		$ReadS[1] = Iniread($datapath, "Scores", "2", "")
		$ReadS[2] = Iniread($datapath, "Scores", "3", "")
		$ReadS[3] = Iniread($datapath, "Scores", "4", "")
		$ReadS[4] = Iniread($datapath, "Scores", "5", "")

		$ReadN[0] = Iniread($datapath, "Names", "1", "")
		$ReadN[1] = Iniread($datapath, "Names", "2", "")
		$ReadN[2] = Iniread($datapath, "Names", "3", "")
		$ReadN[3] = Iniread($datapath, "Names", "4", "")
		$ReadN[4] = Iniread($datapath, "Names", "5", "")

	EndIf
;~ 	MsgBox(0, "", $ReadS[0])
	While 3
	 $y = 400  - $Doodle_Height - 10 - Round (Abs(Sin($i))*$JumpHeight)
		$x = 60
	$i += $JumpSpeed

	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
	_GDIPlus_GraphicsDrawImage($Buffer, $Scorebackground, 0, 0)
	For $n = 0 to 4
		If $ReadS[$n] <> "" Then
			_GDIPlus_GraphicsDrawString($Buffer, $ReadS[$n], $Width - 100, 211 + ($n-1)*23, "Comic Sans MS", 12)
			_GDIPlus_GraphicsDrawString($Buffer, $ReadN[$n], $Width - 240, 211 + ($n-1)*23, "Comic Sans MS", 12)
		EndIf

	Next

    _GDIPlus_GraphicsDrawImage ($Buffer, $Doodle_Rechts, $x, $y)
	_GDIPlus_GraphicsDrawImage ($Buffer, $Platform_gruen, 50, 400)
    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
	Sleep(20)
	If WinActive("[active]") = $GUI1 Then
	$pos = MouseGetPos()
    Select
		Case _IsPressed("01", $dll)
			IF $pos[0] > 163 and $pos[0] < 269 and $pos[1] > 403 and $pos[1] < 444 Then
				_Start()
				ExitLoop
			EndIf
	EndSelect
	EndIf
	Wend
EndFunc ;==> Showscore

Func ende()
	_GDIPlus_GraphicsDispose($Graphic)
            _GDIPlus_ImageDispose($Buffer)
            _WinAPI_DeleteObject($Bitmap)
			_GDIPlus_Shutdown()
			IniWrite($datapath, "Optionen", "Wintermode", $wintermod)
			Exit
		EndFunc ;==> ende

Func Newscore()
	If $soundplayed = 0 Then
	If $soundoff = 0 Then _SoundPlay($sFall)
	$soundplayed = 1
	EndIf
	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
	_GDIPlus_GraphicsDrawImage($Buffer, $Newhighscore, 0, 0)
	_GDIPlus_GraphicsDrawString($Buffer, "Dein Score: " & $scoreplus, 24, 205, "Comic Sans MS", 12)
	_GDIPlus_GraphicsDrawString($Buffer, "Name: ", 24, 225, "Comic Sans MS", 12)
    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
	$ReadName = Iniread($datapath, "Names", "Eingetragenername", "")
	$Input = GUICtrlCreateInput($ReadName, 79, 227)
	GUICtrlSetLimit($Input, 9)
	While 4
		If WinActive("[active]") = $GUI1 Then
$pos = MouseGetPos()
    Select
		Case _IsPressed("01", $dll)
			IF $pos[0] > 98 and $pos[0] < 207 and $pos[1] > 284 and $pos[1] < 324 Then
				$Name = GUICtrlRead($Input)
				If $Name = "" Then $Name = "Spieler"
;~ 				If $serveroff = 0 Then
;~ 					_sendtoserver($Name, $scoreplus)
;~ 				Else
;~ 					_isserveron()
;~ 				EndIf



				_iniwrite($Name)

				If FileExists($datapath) Then
					$ReadS[0] = Iniread($datapath, "Scores", "1", "")
					$ReadS[1] = Iniread($datapath, "Scores", "2", "")
					$ReadS[2] = Iniread($datapath, "Scores", "3", "")
					$ReadS[3] = Iniread($datapath, "Scores", "4", "")
					$ReadS[4] = Iniread($datapath, "Scores", "5", "")

					$ReadN[0] = Iniread($datapath, "Names", "1", "")
					$ReadN[1] = Iniread($datapath, "Names", "2", "")
					$ReadN[2] = Iniread($datapath, "Names", "3", "")
					$ReadN[3] = Iniread($datapath, "Names", "4", "")
					$ReadN[4] = Iniread($datapath, "Names", "5", "")

					$ReadName = Iniread($datapath, "Names", "Eingetragenername", "")
				EndIf


				$AktuellerDoodle = $Doodle_Rechts
				Global $gruen_n[17][4] = [[Random(0, $Width - $Plat_Width, 1), 400, 0, 0], [Random(0, $Width - $Plat_Width, 1), 370, 0, 0], [Random(0, $Width - $Plat_Width, 1), 340, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 310, 0, 0], [Random(0, $Width - $Plat_Width, 1), 280, 0, 0], [Random(0, $Width - $Plat_Width, 1), 250, 0, 0], [Random(0, $Width - $Plat_Width, 1), 220, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 190, 0, 0], [Random(0, $Width - $Plat_Width, 1), 160, 0, 0], [Random(0, $Width - $Plat_Width, 1), 130, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 100, 0, 0], [Random(0, $Width - $Plat_Width, 1), 70, 0, 0], [Random(0, $Width - $Plat_Width, 1), 40, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 10, 0, 0], [Random(0, $Width - $Plat_Width, 1), -20, 0, 0], [Random(0, $Width - $Plat_Width, 1), -50, 0, 0], [Random(0, $Width - $Plat_Width, 1), -80, 0, 0]]


				$Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI1)
				$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $Graphic)
				$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)
				$die = False

				$t = 0
				$x = $gruen_n[0][0]
				$y  = 380 - $Doodle_Height
				$onplatform = 0
				$plat = 0
				$MoveSpeed = 0
				$move =0
				$yboden = $gruen_n[0][1]
				$Platmovespeed = 0
				$platten = 0
				$score = 0
				$scoreplus = 0
				GUICtrlDelete($Input)
				ExitLoop
			EndIf

			IF $pos[0] > 151 and $pos[0] < 261 and $pos[1] > 346 and $pos[1] < 381 Then
				$Name = GUICtrlRead($Input)
				If $Name = ""  or $Name = " " or $Name = "  " or $Name = "   " or $Name = "    " or $Name = "     " or $Name = "      " or $Name = "       " or $Name = "        " or $Name = "         "Then
					$Name = "Spieler"
					Endif
;~ 				If $serveroff = 0 Then
;~ 					_sendtoserver($Name, $scoreplus)
;~ 				Else
;~ 					_isserveron()
;~ 				EndIf

				_iniwrite($Name)
				GUICtrlDelete($Input)
				_Start()
				ExitLoop

			EndIf
		EndSelect
		EndIf
		Wend
			EndFunc

Func _iniwrite($Name)
If $scoreplus > $ReadS[4] Then
	If $scoreplus > $ReadS[3] Then
		If $scoreplus > $ReadS[2] Then
			If $scoreplus > $ReadS[1] Then
				If $scoreplus > $ReadS[0] Then
					Iniwrite($datapath, "Scores", "1", $scoreplus)
					Iniwrite($datapath, "Scores", "2", $ReadS[0])
					Iniwrite($datapath, "Scores", "3", $ReadS[1])
					Iniwrite($datapath, "Scores", "4", $ReadS[2])
					Iniwrite($datapath, "Scores", "5", $ReadS[3])

					Iniwrite($datapath, "Names", "1", $Name)
					Iniwrite($datapath, "Names", "2", $ReadN[0])
					Iniwrite($datapath, "Names", "3", $ReadN[1])
					Iniwrite($datapath, "Names", "4", $ReadN[2])
					Iniwrite($datapath, "Names", "5", $ReadN[3])
				Else
					Iniwrite($datapath, "Scores", "2", $scoreplus)
					Iniwrite($datapath, "Scores", "3", $ReadS[1])
					Iniwrite($datapath, "Scores", "4", $ReadS[2])
					Iniwrite($datapath, "Scores", "5", $ReadS[3])

					Iniwrite($datapath, "Names", "2", $Name)
					Iniwrite($datapath, "Names", "3", $ReadN[1])
					Iniwrite($datapath, "Names", "4", $ReadN[2])
					Iniwrite($datapath, "Names", "5", $ReadN[3])
				EndIf

			Else
				Iniwrite($datapath, "Scores", "3", $scoreplus)
				Iniwrite($datapath, "Scores", "4", $ReadS[2])
				Iniwrite($datapath, "Scores", "5", $ReadS[3])

				Iniwrite($datapath, "Names", "3", $Name)
				Iniwrite($datapath, "Names", "4", $ReadN[2])
				Iniwrite($datapath, "Names", "5", $ReadN[3])
			EndIf

		Else
			Iniwrite($datapath, "Scores", "4", $scoreplus)
			Iniwrite($datapath, "Scores", "5", $ReadS[3])
			Iniwrite($datapath, "Names", "4", $Name)
			Iniwrite($datapath, "Names", "5", $ReadN[3])
		EndIf

	Else
		Iniwrite($datapath, "Scores", "5", $scoreplus)
		Iniwrite($datapath, "Names", "5", $Name)
	EndIf

EndIf
IniWrite($datapath, "Names", "Eingetragenername", $Name)
EndFunc

Func Dead()
	If $soundplayed = 0 Then
	If $soundoff = 0 Then _SoundPlay($sFall)
	$soundplayed = 1
	EndIf
		_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)
	_GDIPlus_GraphicsDrawImage($Buffer, $Gameover, 0, 0)
	_GDIPlus_GraphicsDrawString($Buffer, "Dein Score: " & $scoreplus, 24, 185, "Comic Sans MS", 12)


    _GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
If WinActive("[active]") = $GUI1 Then
$pos = MouseGetPos()
    Select
		Case _IsPressed("01", $dll)
			IF $pos[0] > 93 and $pos[0] < 197 and $pos[1] > 253 and $pos[1] < 290 Then
;~ 			If $serveroff = 0 Then
;~ 					_sendtoserver(_GetIP(), $scoreplus)
;~ 				Else
;~ 					_isserveron()
;~ 				EndIf

				If FileExists($datapath) Then
					$ReadS[0] = Iniread($datapath, "Scores", "1", "")
					$ReadS[1] = Iniread($datapath, "Scores", "2", "")
					$ReadS[2] = Iniread($datapath, "Scores", "3", "")
					$ReadS[3] = Iniread($datapath, "Scores", "4", "")
					$ReadS[4] = Iniread($datapath, "Scores", "5", "")

					$ReadN[0] = Iniread($datapath, "Names", "1", "")
					$ReadN[1] = Iniread($datapath, "Names", "2", "")
					$ReadN[2] = Iniread($datapath, "Names", "3", "")
					$ReadN[3] = Iniread($datapath, "Names", "4", "")
					$ReadN[4] = Iniread($datapath, "Names", "5", "")
				EndIf


				$AktuellerDoodle = $Doodle_Rechts
				Global $gruen_n[17][4] = [[Random(0, $Width - $Plat_Width, 1), 400, 0, 0], [Random(0, $Width - $Plat_Width, 1), 370, 0, 0], [Random(0, $Width - $Plat_Width, 1), 340, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 310, 0, 0], [Random(0, $Width - $Plat_Width, 1), 280, 0, 0], [Random(0, $Width - $Plat_Width, 1), 250, 0, 0], [Random(0, $Width - $Plat_Width, 1), 220, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 190, 0, 0], [Random(0, $Width - $Plat_Width, 1), 160, 0, 0], [Random(0, $Width - $Plat_Width, 1), 130, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 100, 0, 0], [Random(0, $Width - $Plat_Width, 1), 70, 0, 0], [Random(0, $Width - $Plat_Width, 1), 40, 0, 0], _
[Random(0, $Width - $Plat_Width, 1), 10, 0, 0], [Random(0, $Width - $Plat_Width, 1), -20, 0, 0], [Random(0, $Width - $Plat_Width, 1), -50, 0, 0], [Random(0, $Width - $Plat_Width, 1), -80, 0, 0]]


				$Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI1)
				$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $Graphic)
				$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)
				$die = False

				$t = 0
				$x = $gruen_n[0][0]
				$y  = 380 - $Doodle_Height
				$onplatform = 0
				$plat = 0
				$MoveSpeed = 0
				$move =0
				$yboden = $gruen_n[0][1]
				$Platmovespeed = 0
				$platten = 0
				$score = 0
				$scoreplus = 0

			EndIf

			IF $pos[0] > 154 and $pos[0] < 260 and $pos[1] > 316 and $pos[1] < 352 Then
;~ 			If $serveroff = 0 Then
;~ 					_sendtoserver(_GetIP(), $scoreplus)
;~ 				Else
;~ 					_isserveron()
;~ 				EndIf

				_Start()

			EndIf
		EndSelect
	EndIf

		EndFunc






Func _winter()
$Background = $wBackground
$Start = $wStart
$DoodleHutl = $wDoodleHutl
$DoodleHutr = $wDoodleHutr
$DoodleHutl1 = $wDoodleHutl1
$DoodleHutr1 = $wDoodleHutr1
$Punkteleiste = $wPunkteleiste
$Platform_gruen = $wPlatform_gruen
$Platform_hellblau = $wPlatform_hellblau
$Doodle_Rechts = $wDoodle_Rechts
$Doodle_Links = $wDoodle_Links
$Doodle_Height = $wDoodle_Height
$Doodle_Width = $wDoodle_Width
$Plat_Width = $wPlat_Width
$DoodleRakl = $wDoodleRakl
$DoodleRakr = $wDoodleRakr
If $AktuellerDoodle = $Doodle_Links Then
	$AktuellerDoodle = $Doodle_Links
Else
	$AktuellerDoodle = $Doodle_Rechts
EndIf
$wintermod = 1
EndFunc

Func _winteroff()
$Background = $nBackground
$Start = $nStart
$DoodleHutl = $nDoodleHutl
$DoodleHutr = $nDoodleHutr
$DoodleHutl1 = $nDoodleHutl1
$DoodleHutr1 = $nDoodleHutr1
$Punkteleiste = $nPunkteleiste
$Platform_gruen = $nPlatform_gruen
$Platform_hellblau = $nPlatform_hellblau
$Doodle_Rechts = $nDoodle_Rechts
$Doodle_Links = $nDoodle_Links
$Doodle_Height = $nDoodle_Height
$Doodle_Width = $nDoodle_Width
$Plat_Width = $nPlat_Width
$DoodleRakl = $nDoodleRakl
$DoodleRakr = $nDoodleRakr
If $AktuellerDoodle = $Doodle_Links Then
	$AktuellerDoodle = $Doodle_Links
Else
	$AktuellerDoodle = $Doodle_Rechts
EndIf


$wintermod = 0
EndFunc

Func _pause()
	If $paused = 0 Then
		$paused = 1
	Else
		$paused = 0
	EndIf
EndFunc

;~ Func _sendtoserver($Name, $Score)
;~ 	_isserveron()
;~ 	If $serveroff = 0 Then
;~ $hCon = TCPConnect($IP,$PORT)

;~ TCPSend($hCon,$Name&"|"&$Score)


;~ EndIf

;~ EndFunc

;~ Func _isserveron()
;~ 	Ping($IP, 100)
;~ 	If @error Then $serveroff = 1
;~ 	If not @error Then $serveroff = 0
;~ EndFunc




