#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>
#include <String.au3>

$Width = 300
$Height = 460

$JumpSpeed = 0.15
$JumpHeight = 80 ;Pixel
$MoveSpeed = 0
$Zeitschrit = 0.2



;==================== Hotkeyset, Gui, Eventmode
HotKeySet("{ESC}", "_pause")
HotKeySet("{pause}", "_pause")
HotKeySet("p", "_pause")



Global $gfWeAreActive=False
$GUI1 = GUICreate("Doodle Jump - Beta", $Width, $Height)
GUIRegisterMsg($WM_ACTIVATEAPP, "MY_WM_ACTIVATEAPP")

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")
$sSf = _SoundOpen(@ScriptDir & "\Sounds\springshoes.wav")
$sTrampolin = _SoundOpen(@ScriptDir & "\Sounds\trampoline.wav")
$sExpl = _SoundOpen(@ScriptDir & "\Sounds\explodingplatform2.wav")


;=========================== Gdi+ Grafik vorbereiten
_GDIPlus_Startup()
$Graphic = _GDIPlus_GraphicsCreateFromHWND($GUI1)
$Bitmap = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $Graphic)
$Buffer = _GDIPlus_ImageGetGraphicsContext($Bitmap)

$Bitmappause = _GDIPlus_BitmapCreateFromGraphics($Width, $Height, $Graphic)
$Pausebuffer = _GDIPlus_ImageGetGraphicsContext($Bitmappause)


;=========================== 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)
$sf_schuhe = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Sf schuhe.gif")
$Trampolin = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Trampolin.gif")
$Trampolin1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Trampolin 1.gif")
$pause_up = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Paused up.gif")
$pause_down = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Paused down.gif")
$menu = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\menu 2.gif")
$play_again = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\play_again 2.gif")
$Pause_eraenzung = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Pause_eraenzung 2.gif")
$Explusion = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Explosion.png")


;=========================== 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_BitmapCreateFromFile(@ScriptDir & "\Bilder\Doodle_Rechts e.png")
$nDoodle_Links = _GDIPlus_BitmapCreateFromFile(@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")
$nDoodle_sf_r = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Doodle_Sf_r.gif")
$nDoodle_sf_l = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Doodle_Sf_l.gif")
$nDoodle_sf_gesch_l = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Doodle_Sf_gesch_l.gif")
$nDoodle_sf_gesch_r = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Doodle_Sf_gesch_r.gif")
$nDoodle_sf_Height = _GDIPlus_ImageGetHeight($nDoodle_sf_r)
$nDoodle_sf_gesch_Height = _GDIPlus_ImageGetHeight($nDoodle_sf_gesch_l)
$nPlatform_grau = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform grau.gif")
$nPlatform_braun1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform braun1.gif")
$nPlatform_braun2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform braun2.gif")
$Platform_weis = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform weis.gif")
$nPlatform_gelb = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform gelb.gif")
$nPlatform_rot = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Platform rot.png")


;=========================== 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")
$wDoodle_sf_r = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Doodle_Sf_r.gif")
$wDoodle_sf_l = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Doodle_Sf_l.gif")
$wDoodle_sf_gesch_l = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Doodle_Sf_gesch_l.gif")
$wDoodle_sf_gesch_r = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Doodle_Sf_gesch_r.gif")
$wDoodle_sf_Height = _GDIPlus_ImageGetHeight($wDoodle_sf_r)
$wDoodle_sf_gesch_Height = _GDIPlus_ImageGetHeight($wDoodle_sf_gesch_l)
$wPlatform_grau = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter gruen.gif")
$wPlatform_braun1 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Platform braun1.gif")
$wPlatform_braun2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter Platform braun2.gif")
$wPlatform_rot = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter rot.png")
$wPlatform_gelb = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Bilder\Winter gelb.png")


;============================= 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], $braunf[17], $bAngle[17], $weisweg[13], $gro60[13], $bei90grad[17],  $explodiert[13] , $soundplaye[13], $gelbweg[13], $rotweg[13], $wtrans[13], $gtrans[13], $image1, $bewegh[20], $Platform_braun1, $Platform_braun2, $federpos[20], $ReadN[5], $gruen_n[13][4], $optioncoloron = 0xff7CB639, $untereplatte = 1, $optioncoloroff = 0xffABA69F, $hutt = 3, $tnorm, $grav = 9.81, $untersprung = 0, $nAktuellerDoodle, $fSprung = 0, $Angle = 0, $sprung = 0, $sprungkraft = 50, $Sprungf = 0, $Sprungnu = 0
Global $Background, $Start, $DoodleHutl, $DoodleHutr, $DoodleHutl1, $DoodleHutr1, $Punkteleiste, $Platform_gruen, $Platform_hellblau, $AktuellerDoodle, $Doodle_sf_gesch_Height, $zuletztresetet = 12, _
		$Doodle_Rechts, $Doodle_Links, $Doodle_Height, $Doodle_Width, $Plat_Width, $DoodleRakl, $DoodleRakr, $Doodle_sf_l, $Platform_weis, $Platform_rot, $Platform_gelb, $Doodle_sf_r, $Platform_grau, $Doodle_sf_gesch_r, $Doodle_sf_gesch_l, $Doodle_sf_Height
Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $i = 0, $t = 0, $y = $Height - $Doodle_Height, $verschluss = False, _
		$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0, $x25 = $Width / 2 - 64, $y25 = $Height / 2 - 37.5
Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move = 0, $score = 0, $scoreplus = 0, $yboden = $Height, $Platmovespeed = 0, $platten = 0, $huton = 0, $nAngle = 0, $timeron = 0, $dll = DllOpen("user32.dll"), $Sprungnu = 0
Global Const $Pi_Div_180 = 4 * ATan(1) / 180


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)]

Global $vbewegrichtung[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 19
	$bewegh[$n] = 0
Next


$gruen_n[0][0] = 200
$gruen_n[1][0] = 150
For $n = 0 To UBound($gruen_n) - 1
	If (Not $n = 0 Or $n = 1) Then
		$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	EndIf
	$bAngle[$n] = 0
	$braunf[$n] = 0
	$explodiert[$n] = 0
	$gelbweg[$n] = 0
	$gro60[$n] = 0
	$rotweg[$n] = 0
	$gtrans[$n] = 1
	$wtrans[$n] = 1
	$gruen_n[$n][1] = 400 + ($n * $abstand) ;$abstand ist Negativ!!!!!!
	$gruen_n[$n][2] = 0
	$gruen_n[$n][3] = 0
Next




;==================== Inireads
$datapath = @ScriptDir & "\Scores.ini"
$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", "")

$ReadS[0] = _StringEncrypt(0,$ReadS[0],"geheim",3)
$ReadS[1] = _StringEncrypt(0,$ReadS[1],"geheim",3)
$ReadS[2] = _StringEncrypt(0,$ReadS[2],"geheim",3)
$ReadS[3] = _StringEncrypt(0,$ReadS[3],"geheim",3)
$ReadS[4] = _StringEncrypt(0,$ReadS[4],"geheim",3)

$ReadN[0] = _StringEncrypt(0,$ReadN[0],"geheim",3)
$ReadN[1] = _StringEncrypt(0,$ReadN[1],"geheim",3)
$ReadN[2] = _StringEncrypt(0,$ReadN[2],"geheim",3)
$ReadN[3] = _StringEncrypt(0,$ReadN[3],"geheim",3)
$ReadN[4] = _StringEncrypt(0,$ReadN[4],"geheim",3)


;============================= 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


If $gruen_n[0][0] < 60 + $Doodle_Width And $gruen_n[0][0] + $Plat_Width > 60 + $Doodle_Width Then
	$x = $Width - 60
Else
	$x = 60
EndIf

_Start()

While 1
	If $paused = 0 Then
		$y25 = $Height / 2 - 37.5
		$y26 = $y25 + 36
		EndIf
	If $paused = 1 Then
	_pausebild()
	EndIf
	If $untereplatte = 0 Then
		If $y - 5 > $Height Then $die = True
	EndIf
;~ MsgBox(0, "", $untereplatte)

	If $die = False Then
		If $gfWeAreActive 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 And $Sprungf = 0
					$AktuellerDoodle = $Doodle_Links
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakl
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutl
				Case $Sprungf = 1
					$AktuellerDoodle = $Doodle_sf_l

			EndSelect


		EndIf
		If $aktualpos[0] > $Width / 2 Then
			$MoveSpeed = ($aktualpos[0] - $Width / 2) / 3
			Select
				Case $huton = 0 And $raketeon = 0 And $Sprungf = 0
					$AktuellerDoodle = $Doodle_Rechts
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakr
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutr
				Case $Sprungf = 1
					$AktuellerDoodle = $Doodle_sf_r
			EndSelect
		EndIf
	Else
		If _IsPressed("25", $dll) Then
			$MoveSpeed -= 2
			Select
				Case $huton = 0 And $raketeon = 0 And $Sprungf = 0
					$AktuellerDoodle = $Doodle_Links
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakl
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutl
				Case $Sprungf = 1
					$AktuellerDoodle = $Doodle_sf_l
			EndSelect
		EndIf
		If _IsPressed("27", $dll) Then
			$MoveSpeed += 2
			Select
				Case $huton = 0 And $raketeon = 0 And $Sprungf = 0
					$AktuellerDoodle = $Doodle_Rechts
				Case $raketeon = 1
					$AktuellerDoodle = $DoodleRakr
				Case $huton = 1
					$AktuellerDoodle = $DoodleHutr
				Case $Sprungf = 1
					$AktuellerDoodle = $Doodle_sf_r
			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
;~ 		MsgBox(0, "", $wintermod)
;~ 		If $wintermod = 1 Then


;~ 			If $yboden = $y + 10 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
				If $untersprung = 1 Then
					$Platmovespeed = 14
				Else

					Select
						Case $y < 0
							$Platmovespeed = 14

						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
				EndIf
				If $gruen_n[$n][3] = 7 Then $gruen_n[$n][3] = 6
				If $untersprung = 0 Then
					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 + 10 >= $gruen_n[$n][1])
							If $yalt+1 < $y Then
								If $gruen_n[$n][2] = 3 Then
									$braunf[$n] = 1
								Else
									If  $gruen_n[$n][2] = 4 Then
									if $weisweg[$n] = 0  Then



								$onplatform = 1
								$plat = $n
								$t = 0
								$t = $Zeitschrit
								$yboden = $gruen_n[$n][1]
								$platten += 1
								EndIf
							ElseIf  $gruen_n[$n][2] = 5 Then
									if $rotweg[$n] = 0 Then
							$onplatform = 1
								$plat = $n
								$t = 0
								$t = $Zeitschrit
								$yboden = $gruen_n[$n][1]
								$platten += 1
							EndIf
						Else
							$onplatform = 1
								$plat = $n
								$t = 0
								$t = $Zeitschrit
								$yboden = $gruen_n[$n][1]
								$platten += 1

							EndIf

								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 /= 1.5
								EndIf
								If $sprung = 2 Then
									$fSprung = 0
									$sprung = 0
									$sprungkraft /= 2
								EndIf



								If $gruen_n[$n][3] = 3 Then
									If ($gruen_n[$n][0] + $federpos[$n] - $Doodle_Width <= $x And $gruen_n[$n][0] + $federpos[$n] + 17 >= $x) Then
										If $soundoff = 0 Then _SoundPlay($sSprung)
										$gruen_n[$n][3] = 4
										$sprung = 1
										$sprungkraft *= 1.5
									EndIf
								EndIf
								If $gruen_n[$n][3] = 6 Then

									$gruen_n[$n][3] = 7
									$sprung = 2
									$sprungkraft *= 2
								EndIf


								If $Sprungf = 0 Then
									If $gruen_n[$n][3] = 5 Then

										If $AktuellerDoodle = $Doodle_Rechts Then
											$AktuellerDoodle = $Doodle_sf_gesch_r
										Else
											$AktuellerDoodle = $Doodle_sf_gesch_l
										EndIf

										$gruen_n[$n][3] = 0
										$sprungkraft = 70
										$Sprungf = 1
									EndIf
								EndIf
								If $Sprungf = 1 Then

									If $AktuellerDoodle = $Doodle_sf_r Then
										$AktuellerDoodle = $Doodle_sf_gesch_r
									Else
										$AktuellerDoodle = $Doodle_sf_gesch_l
									EndIf

									If $Sprungnu = 6 Then
										$Sprungf = 0
										$Sprungnu = 0
										$sprungkraft = 50
										If $AktuellerDoodle = $Doodle_sf_gesch_r Then
											$AktuellerDoodle = $Doodle_Rechts
										Else
											$AktuellerDoodle = $Doodle_Links
										EndIf
										$Doodle_Height = _GDIPlus_ImageGetHeight($AktuellerDoodle)
									Else
										$Sprungnu += 1
									EndIf

								EndIf
								If $soundoff = 0 and $rotweg[$n] = 0 and $weisweg[$n] = 0 Then
									If $sprung = 0 And $Sprungf = 0 Then _SoundPlay($sJump)
									If $Sprungf = 1 Then _SoundPlay($sSf)
									If $sprung = 2 Then _SoundPlay($sTrampolin)
									If $sprung = 1 Then _SoundPlay($sSprung)
								EndIf
								If $gruen_n[$n][2] = 4 Then

									$weisweg[$n] = 1
								EndIf

EndIf
							EndIf


					EndSelect
				EndIf
			Next
		EndIf
	EndIf
	If $untereplatte = 1 Then
		If $y + $Doodle_Height > $Height - 20 And $y + $Doodle_Height < $Height Then
			If $soundoff = 0 Then _SoundPlay($sJump)
			$yboden = $Height
			$t = 0
			$t = $Zeitschrit
			$untereplatte = 1
		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
;~
		$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


;~ 	$Doodle_Height = _GDIPlus_ImageGetHeight($AktuellerDoodle)
;~ 	$Doodle_Width = _GDIPlus_ImageGetWidth($AktuellerDoodle)




	If $fSprung = 0 Then
		If $sprung = 2 Then
			If $Angle = 360 Then
				$Angle = 0
				$untersprung = 0
				$fSprung = 1
			Else
				$untersprung = 1
				$Angle += 15
			EndIf
		EndIf
	EndIf




	If $move = 1 Then
		$untereplatte = 0
		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
;~ MsgBox(0, "", $braunf[$n])
			If $gruen_n[$n][2] = 2 Then
				If Abs($bewegh[$n]) >= 32 Then
					If $vbewegrichtung[$n] = 1 Then
						$vbewegrichtung[$n] = 0
					Else
						$vbewegrichtung[$n] = 1
					EndIf
				EndIf



				If $vbewegrichtung[$n] = 1 Then
					$gruen_n[$n][1] += 2
					$bewegh[$n] += 2
				Else
					$gruen_n[$n][1] -= 2
					$bewegh[$n] -=2
				EndIf
			EndIf
			If $gruen_n[$n][2] = 2 Then
			If $gruen_n[$n][1] - $bewegh[$n] > $Height+50 Then
				reset($n)
			EndIf
		Else
			If $gruen_n[$n][1] - $bewegh[$n] > $Height Then
				reset($n)
			EndIf
			EndIf




		Next

	EndIf

;~ MsgBox(0, "", $MoveSpeed)

;~     _GDIPlus_GraphicsClear($Buffer, 0xFFFFFFFF)
;~ 	_WinAPI_RedrawWindow($GUI1, "", "", $RDW_UPDATENOW + $RDW_FRAME)

	_GDIPlus_GraphicsDrawImage($Buffer, $Background, 0, 0)



If $Angle = 0 Then
		$nAktuellerDoodle = $AktuellerDoodle
	EndIf



	If $wintermod = 1 Then
If $sprung = 2 And $fSprung = 0 Then
		_GDIPlus_GraphicsTranslateTransform($Buffer, $x + $Doodle_Width / 2, $y + $Doodle_Height / 2)
		If $nAktuellerDoodle = $Doodle_Links Then
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		Else
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle * - 1)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		EndIf
		_GDIPlus_GraphicsResetTransform($Buffer)
	Else
		_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $x, $y+10)
	EndIf
	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] + $federpos[$n], $gruen_n[$n][1] - $Federz_Height)
				Case 4
					_GDIPlus_GraphicsDrawImage($Buffer, $Federoffen, $gruen_n[$n][0] + $federpos[$n], $gruen_n[$n][1] - $Federo_Height )
				Case 5
					_GDIPlus_GraphicsDrawImage($Buffer, $sf_schuhe, $gruen_n[$n][0], $gruen_n[$n][1] - 21 )
				Case 6
					_GDIPlus_GraphicsDrawImage($Buffer, $Trampolin, $gruen_n[$n][0] + 15, $gruen_n[$n][1] - 14 )
				Case 7
					_GDIPlus_GraphicsDrawImage ($Buffer, $Trampolin1, $gruen_n[$n][0]+15, $gruen_n[$n][1]-14)

			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_grau, $gruen_n[$n][0], $gruen_n[$n][1])
			Case 3
					If $braunf[$n] = 1 Then
						If $bAngle[$n] = 90 Then
							$bAngle[$n] = 0
							$braunf[$n] = 0
							$bei90grad[$n] = 1
						Else
						$bAngle[$n] += 10
					EndIf
					EndIf
					If $bei90grad[$n] = 1 Then
						$gruen_n[$n][1] += 7.5
						$brAngle = 90
					Else

						$brAngle = $bAngle[$n]
						If $brAngle > 0 Then
						$gruen_n[$n][1] += 7.5
					EndIf

					EndIf


						_GDIPlus_GraphicsTranslateTransform($Buffer, $gruen_n[$n][0], $gruen_n[$n][1]+7.5)
							_GDIPlus_GraphicsRotateTransform($Buffer, $brAngle )
;~ 							MsgBox(0,"1", $bAngle[$n]&$n)
							_GDIPlus_GraphicsDrawImage($Buffer, $Platform_braun2, 0, -7.5)
							_GDIPlus_GraphicsResetTransform($Buffer)
							_GDIPlus_GraphicsTranslateTransform($Buffer, $gruen_n[$n][0]+60, $gruen_n[$n][1]+7.5)
							_GDIPlus_GraphicsRotateTransform($Buffer, $brAngle* - 1)
							_GDIPlus_GraphicsDrawImage($Buffer, $Platform_braun1, -33, -7.5)
						_GDIPlus_GraphicsResetTransform($Buffer)

				Case 4

						If $weisweg[$n] = 1 Then
							If  $wtrans[$n] < 250 Then
							$wtrans[$n] += 25
						EndIf
					EndIf
					_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_gruen, 0, 0, "", "", $gruen_n[$n][0], $gruen_n[$n][1], "", "", 2, $wtrans[$n])

				Case 5
					If $gruen_n[$n][2] = 5 Then
					If $gruen_n[$n][1] > 60 and $gro60[$n] = 0 Then
						$gelbweg[$n] = 1
						$gro60[$n] = 1
					EndIf

				EndIf
					If $gelbweg[$n] = 1 Then
							$gtrans[$n] += 6
						EndIf
						If $gtrans[$n] > 254 Then
							$gtrans[$n] = 0
						$gelbweg[$n] = 0
						$rotweg[$n] = 1

					EndIf
					If $rotweg[$n] = 1 Then
						$rotweg[$n] = -5

					EndIf


					If $rotweg[$n] < -2 Then

					_GDIplus_GraphicsDrawImage($Buffer, $Explusion, $gruen_n[$n][0]-4, $gruen_n[$n][1]-4)
					If $soundoff = 0 and $soundplaye[$n] = 0 Then
					_SoundPlay($sExpl)
					$soundplaye[$n] = 1

					EndIf
					$rotweg[$n] += 1

				EndIf

					If $rotweg[$n] = 0 Then
					_GDIPlus_GraphicsDrawImageRect($Buffer, $Platform_rot, $gruen_n[$n][0], $gruen_n[$n][1], 57, 16)
					_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_gelb, 0, 0, "", "", $gruen_n[$n][0], $gruen_n[$n][1], "", "", 2, $gtrans[$n])
				EndIf

			EndSwitch
		Next
		If $sprung = 2 And $fSprung = 0 Then
		_GDIPlus_GraphicsTranslateTransform($Buffer, $x + $Doodle_Width / 2, $y + $Doodle_Height / 2)
		If $nAktuellerDoodle = $Doodle_Links Then
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		Else
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle * - 1)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		EndIf
		_GDIPlus_GraphicsResetTransform($Buffer)
	Else
		_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $x, $y+10)
	EndIf
	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] + $federpos[$n], $gruen_n[$n][1] - $Federz_Height)
				Case 4
					_GDIPlus_GraphicsDrawImage($Buffer, $Federoffen, $gruen_n[$n][0] + $federpos[$n], $gruen_n[$n][1] - $Federo_Height)
				Case 5
					_GDIPlus_GraphicsDrawImage($Buffer, $sf_schuhe, $gruen_n[$n][0], $gruen_n[$n][1] - 21)
				Case 6
					_GDIPlus_GraphicsDrawImage($Buffer, $Trampolin, $gruen_n[$n][0] + 15, $gruen_n[$n][1] - 14)
					Case 7
					_GDIPlus_GraphicsDrawImage ($Buffer, $Trampolin1, $gruen_n[$n][0]+15, $gruen_n[$n][1]-14)

			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_grau, $gruen_n[$n][0], $gruen_n[$n][1])
				Case 3
					If $braunf[$n] = 1 Then
						If $bAngle[$n] = 90 Then
							$bAngle[$n] = 0
							$braunf[$n] = 0
							$bei90grad[$n] = 1
						Else
						$bAngle[$n] += 10
					EndIf
					EndIf
					If $bei90grad[$n] = 1 Then
						$gruen_n[$n][1] += 7.5
						$brAngle = 90
					Else

						$brAngle = $bAngle[$n]
						If $brAngle > 0 Then
						$gruen_n[$n][1] += 7.5
					EndIf

					EndIf


						_GDIPlus_GraphicsTranslateTransform($Buffer, $gruen_n[$n][0], $gruen_n[$n][1]+7.5)
							_GDIPlus_GraphicsRotateTransform($Buffer, $brAngle )
;~ 							MsgBox(0,"1", $bAngle[$n]&$n)
							_GDIPlus_GraphicsDrawImage($Buffer, $Platform_braun1, 0, -7.5)
							_GDIPlus_GraphicsResetTransform($Buffer)
							_GDIPlus_GraphicsTranslateTransform($Buffer, $gruen_n[$n][0]+57, $gruen_n[$n][1]+7.5)
							_GDIPlus_GraphicsRotateTransform($Buffer, $brAngle* - 1)
							_GDIPlus_GraphicsDrawImage($Buffer, $Platform_braun2, -31, -7.5)
						_GDIPlus_GraphicsResetTransform($Buffer)

					Case 4

					If $weisweg[$n] = 1 Then
							If  $wtrans[$n] < 250 Then
							$wtrans[$n] += 25
						EndIf
					EndIf
					_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_weis, 0, 0, "", "", $gruen_n[$n][0], $gruen_n[$n][1], "", "", 2, $wtrans[$n])

					Case 5
					If $gruen_n[$n][2] = 5 Then
					If $gruen_n[$n][1] > 60 and $gro60[$n] = 0 Then
						$gelbweg[$n] = 1
						$gro60[$n] = 1
					EndIf

				EndIf
					If $gelbweg[$n] = 1 Then
							$gtrans[$n] += 6
						EndIf
						If $gtrans[$n] > 254 Then
							$gtrans[$n] = 0
						$gelbweg[$n] = 0
						$rotweg[$n] = 1

					EndIf
					If $rotweg[$n] = 1 Then
						$rotweg[$n] = -5

					EndIf


					If $rotweg[$n] < -2 Then

					_GDIplus_GraphicsDrawImage($Buffer, $Explusion, $gruen_n[$n][0]-4, $gruen_n[$n][1]-4)
					If $soundoff = 0 and $soundplaye[$n] = 0 Then
					_SoundPlay($sExpl)
					$soundplaye[$n] = 1

					EndIf
					$rotweg[$n] += 1

				EndIf

					If $rotweg[$n] = 0 Then
					_GDIPlus_GraphicsDrawImageRect($Buffer, $Platform_rot, $gruen_n[$n][0], $gruen_n[$n][1], 57, 16)
					_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Platform_gelb, 0, 0, "", "", $gruen_n[$n][0], $gruen_n[$n][1], "", "", 2, $gtrans[$n])
				EndIf

			EndSwitch

		Next
		If $sprung = 2 And $fSprung = 0 Then
		_GDIPlus_GraphicsTranslateTransform($Buffer, $x + $Doodle_Width / 2, $y + $Doodle_Height / 2)
		If $nAktuellerDoodle = $Doodle_Links Then
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		Else
			_GDIPlus_GraphicsRotateTransform($Buffer, $Angle * - 1)
			_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $Doodle_Width / 2 * - 1, $Doodle_Height / 2 * - 1)
		EndIf
		_GDIPlus_GraphicsResetTransform($Buffer)
	Else
		_GDIPlus_GraphicsDrawImage($Buffer, $AktuellerDoodle, $x, $y)
	EndIf
	EndIf









	_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Punkteleiste, 0, 0, "", "", "", "", "", "", 2, 50)
	_GDIPlus_GraphicsDrawString($Buffer, Round($score, 0), 5, 5, "Comic Sans MS", 15)
	_GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
	_GDIPlus_GraphicsDrawImageRect($Pausebuffer, $Bitmap, 0, 0, $Width, $Height)

	Sleep(20)

EndFunc   ;==>Redraw
;====================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================
;===========================================================================================================================================================




Func reset($n)
	$bei90grad[$n] = 0
	$braunf[$n] = 0
	$wtrans[$n] = 1
	$gtrans[$n] = 1
	$soundplaye[$n] = 0
	$gro60[$n] = 0
	$rotweg[$n] = 0
	$gelbweg[$n] = 0
	$weisweg[$n] = 0
	$bewegh[$n] = 0
	$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)

		$gruen_n[$n][1] = $gruen_n[$zuletztresetet][1] - $bewegh[$zuletztresetet] + $abstand
	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
	Elseif $r = 2 Then
		$gruen_n[$n][2] = 2
	Else
		$gruen_n[$n][2] = 0
	EndIf
	$r = Random(0, 5,1)
	if $r = 2 and (not $gruen_n[$zuletztresetet][2] = 3) Then
		$gruen_n[$n][2] = 3
	EndIf
	if $r = 3 Then
		$gruen_n[$n][2] = 4
	EndIf
	if $r = 4 and (not $gruen_n[$zuletztresetet][2] = 5) Then
		$gruen_n[$n][2] = 5
	EndIf

		If $scoreplus >= $punktelimit Then
		$abstand -= 3
		$punktelimit = $punktelimit + ($punktelimit + 1000)
	EndIf

	If $gruen_n[$n][3] > 0 Then $gruen_n[$n][3] = 0
	If $Sprungf = 0 Then
		If (not $gruen_n[$n][2] = 3) or (not $gruen_n[$n][2] = 4) Then
		$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
			If $n > 13 Then
				$federpos[13] = Random(0, $Plat_Width - 17, 1)
			Else
				$federpos[$n] = Random(0, $Plat_Width - 17, 1)
			EndIf
		EndIf
		;============== $gruen_n[$n][3] = 4 <== wird gebraucht Nicht benutzen!
		If $r = 4 Then $gruen_n[$n][3] = 5
		If $r = 5 Then $gruen_n[$n][3] = 6
		;============== $gruen_n[$n][3] = 7 <== wird gebraucht Nicht benutzen!

	EndIf
	EndIf
	$zuletztresetet = $n
EndFunc   ;==>reset

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 $gfWeAreActive Then
			Select
				Case _IsPressed("01",$dll)
					$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 $federpos[20], $gruen_n[13][4], $optioncoloron = 0xff7CB639, $untereplatte = 1, $optioncoloroff = 0xffABA69F, $hutt = 3, $tnorm, $zuletztresetet = 12, $grav = 9.81, $sprung = 0, $sprungkraft = 50, $Sprungf = 0, $Sprungnu = 0
							Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $t = 0, $y = $Height - $Doodle_Height, $yboden = $Height, _
									$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0
							Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move = 0, $score = 0, $scoreplus = 0, $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)]


							$gruen_n[0][0] = 200
$gruen_n[1][0] = 150
For $n = 0 To UBound($gruen_n) - 1
	If (Not $n = 0 Or $n = 1) Then
		$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	EndIf
	$bAngle[$n] = 0
	$braunf[$n] = 0
	$explodiert[$n] = 0
	$gelbweg[$n] = 0
	$gro60[$n] = 0
	$rotweg[$n] = 0
	$gtrans[$n] = 1
	$wtrans[$n] = 1
	$gruen_n[$n][1] = 400 + ($n * $abstand) ;$abstand ist Negativ!!!!!!
	$gruen_n[$n][2] = 0
	$gruen_n[$n][3] = 0
Next

							$x = $gruen_n[0][0]
							$y = $Height - $Doodle_Height

							$die = False
							$t = 0
							$plat = 0
							$MoveSpeed = 0
							$move = 0
							$Platmovespeed = 0
							$platten = 0
							$score = 0
							$scoreplus = 0
							If $gruen_n[0][0] < 60 + $Doodle_Width And $gruen_n[0][0] + $Plat_Width > 60 + $Doodle_Width Then
								$x = $Width - 60
							Else
								$x = 60
							EndIf
							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 $gfWeAreActive 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   ;==>_optionen




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", "")

		$ReadS[0] = _StringEncrypt(0,$ReadS[0],"geheim",3)
		$ReadS[1] = _StringEncrypt(0,$ReadS[1],"geheim",3)
		$ReadS[2] = _StringEncrypt(0,$ReadS[2],"geheim",3)
		$ReadS[3] = _StringEncrypt(0,$ReadS[3],"geheim",3)
		$ReadS[4] = _StringEncrypt(0,$ReadS[4],"geheim",3)

		$ReadN[0] = _StringEncrypt(0,$ReadN[0],"geheim",3)
		$ReadN[1] = _StringEncrypt(0,$ReadN[1],"geheim",3)
		$ReadN[2] = _StringEncrypt(0,$ReadN[2],"geheim",3)
		$ReadN[3] = _StringEncrypt(0,$ReadN[3],"geheim",3)
		$ReadN[4] = _StringEncrypt(0,$ReadN[4],"geheim",3)

		If $ReadN[0] = "M" Then $ReadN[0] = ""
		If $ReadN[1] = "M" Then $ReadN[1] = ""
		If $ReadN[2] = "M" Then $ReadN[2] = ""
		If $ReadN[3] = "M" Then $ReadN[3] = ""
		If $ReadN[4] = "M" Then $ReadN[4] = ""

		If $ReadS[0] = "M" Then $ReadS[0] = ""
		If $ReadS[1] = "M" Then $ReadS[1] = ""
		If $ReadS[2] = "M" Then $ReadS[2] = ""
		If $ReadS[3] = "M" Then $ReadS[3] = ""
		If $ReadS[4] = "M" Then $ReadS[4] = ""


	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 $gfWeAreActive 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
	$ReadName = IniRead($datapath, "Names", "Eingetragenername", "")
	$ReadName = _StringEncrypt(0,$ReadName,"geheim",3)
	$Input = GUICtrlCreateInput($ReadName, 79, 227)
	GUICtrlSetLimit($Input, 9)
	_GDIPlus_GraphicsClear($Buffer, 0x00000000)
	While 4
	_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)


		If $gfWeAreActive 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)

						Global $federpos[20], $gruen_n[13][4], $optioncoloron = 0xff7CB639, $untereplatte = 1, $optioncoloroff = 0xffABA69F, $hutt = 3, $tnorm, $zuletztresetet = 12,  $grav = 9.81, $sprung = 0, $sprungkraft = 50, $Sprungf = 0, $Sprungnu = 0
						Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $t = 0, $y = $Height - $Doodle_Height, $yboden = $Height, _
								$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0
						Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move = 0, $score = 0, $scoreplus = 0, $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)]


						$gruen_n[0][0] = 200
$gruen_n[1][0] = 150
For $n = 0 To UBound($gruen_n) - 1
	If (Not $n = 0 Or $n = 1) Then
		$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	EndIf
	$bAngle[$n] = 0
	$braunf[$n] = 0
	$explodiert[$n] = 0
	$gelbweg[$n] = 0
	$gro60[$n] = 0
	$rotweg[$n] = 0
	$gtrans[$n] = 1
	$wtrans[$n] = 1
	$gruen_n[$n][1] = 400 + ($n * $abstand) ;$abstand ist Negativ!!!!!!
	$gruen_n[$n][2] = 0
	$gruen_n[$n][3] = 0
Next

						$x = $gruen_n[0][0]
						$y = $Height - $Doodle_Height

						$die = False
						$t = 0
						$plat = 0
						$MoveSpeed = 0
						$move = 0
						$Platmovespeed = 0
						$platten = 0
						$score = 0
						$scoreplus = 0
						If $gruen_n[0][0] < 60 + $Doodle_Width And $gruen_n[0][0] + $Plat_Width > 60 + $Doodle_Width Then
							$x = $Width - 60
						Else
							$x = 60
						EndIf
						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   ;==>Newscore

Func _iniwrite($Name)
$Name = _StringEncrypt(1,$Name,"geheim",3)
	If $scoreplus > $ReadS[4] Then
		If $verschluss = False Then $scoreplus = _StringEncrypt(1,$scoreplus,"geheim",3)
		$verschluss = True
		If $scoreplus > $ReadS[3] Then
			If $verschluss = False Then $scoreplus = _StringEncrypt(1,$scoreplus,"geheim",3)
			$verschluss = True
			If $scoreplus > $ReadS[2] Then
				If $verschluss = False Then $scoreplus = _StringEncrypt(1,$scoreplus,"geheim",3)
				$verschluss = True
				If $scoreplus > $ReadS[1] Then
					If $verschluss = False Then $scoreplus = _StringEncrypt(1,$scoreplus,"geheim",3)
					$verschluss = True
					If $scoreplus > $ReadS[0] Then
						If $verschluss = False Then $scoreplus = _StringEncrypt(1,$scoreplus,"geheim",3)
						$verschluss = True
						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   ;==>_iniwrite

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 $gfWeAreActive 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

					Global $federpos[20], $gruen_n[13][4], $optioncoloron = 0xff7CB639, $untereplatte = 1, $optioncoloroff = 0xffABA69F, $hutt = 3, $zuletztresetet = 12, $tnorm, $grav = 9.81, $sprung = 0, $sprungkraft = 50, $Sprungf = 0, $Sprungnu = 0
					Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $t = 0, $y = $Height - $Doodle_Height, $yboden = $Height, _
							$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0
					Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move = 0, $score = 0, $scoreplus = 0, $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)]


					$gruen_n[0][0] = 200
$gruen_n[1][0] = 150
For $n = 0 To UBound($gruen_n) - 1
	If (Not $n = 0 Or $n = 1) Then
		$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	EndIf
	$bAngle[$n] = 0
	$braunf[$n] = 0
	$explodiert[$n] = 0
	$gelbweg[$n] = 0
	$gro60[$n] = 0
	$rotweg[$n] = 0
	$gtrans[$n] = 1
	$wtrans[$n] = 1
	$gruen_n[$n][1] = 400 + ($n * $abstand) ;$abstand ist Negativ!!!!!!
	$gruen_n[$n][2] = 0
	$gruen_n[$n][3] = 0
Next

					$x = $gruen_n[0][0]
					$y = $Height - $Doodle_Height

					$die = False
					$t = 0
					$plat = 0
					$MoveSpeed = 0
					$move = 0
					$Platmovespeed = 0
					$platten = 0
					$score = 0
					$scoreplus = 0
					If $gruen_n[0][0] < 60 + $Doodle_Width And $gruen_n[0][0] + $Plat_Width > 60 + $Doodle_Width Then
						$x = $Width - 60
					Else
						$x = 60
					EndIf

				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   ;==>Dead


Func MY_WM_ACTIVATEAPP($hWnd, $uMsg, $wParam, $lParam)
    $gfWeAreActive = ($wParam=1)
    Return $GUI_RUNDEFMSG
EndFunc

Func _pausebild()
	_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Schwarz, 0, 0, "", "", "", "", "", "", 2, 50)


		_GDIPlus_GraphicsDrawImage($Buffer, $Pausebild, $x25, $Height / 2 - 37.5)
		Do
;~ 			Sleep(50)
			_GDIPlus_GraphicsDrawImageRect($Buffer, $Bitmap, 0, 0, $Width, $Height)
			If $gfWeAreActive and _IsPressed(01,$dll) Then
				While $y25 > 100
					_GDIPlus_GraphicsDrawImageRect($Buffer, $Bitmappause, 0, 0, $Width, $Height)
					_GDIPlus_GraphicsDrawImageRectRectTrans($Buffer, $Schwarz, 0, 0, "", "", "", "", "", "", 2, 50)
					_GDIPlus_GraphicsDrawImage($Buffer,$pause_up,$x25,$y25)
					_GDIPlus_GraphicsDrawImage($Buffer,$pause_down,$x25,$y26)
					_GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
					$y25 -= 2
					$y26 += 2

;~ 					Sleep(30)
				WEnd
				_GDIPlus_GraphicsDrawImage($Buffer,$Pause_eraenzung,$x25,$y25 +28)
				_GDIPlus_GraphicsDrawImage($Buffer,$play_again,$x25 + 10,170)
				_GDIPlus_GraphicsDrawImage($Buffer,$menu,$x25 + 10,250)

;~ 				Sleep(2000)
				Do
					_GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)
					If $gfWeAreActive and _IsPressed(01,$dll) Then
						$pos = MouseGetPos()
					Select

						Case $pos[0] > 101 And $pos[0] < 205 And $pos[1] > 195 And $pos[1] < 231
							Global $federpos[20], $gruen_n[13][4], $optioncoloron = 0xff7CB639, $untereplatte = 1, $optioncoloroff = 0xffABA69F, $hutt = 3, $tnorm, $zuletztresetet = 12, $grav = 9.81, $sprung = 0, $sprungkraft = 50, $Sprungf = 0, $Sprungnu = 0
							Global $punktelimit = 1000, $abstand = -40, $paused = 0, $die = False, $t = 0, $y = $Height - $Doodle_Height, $yboden = $Height, _
									$onplatform = 0, $t1 = 0, $normpos, $huttimer, $ybodenalt, $hutbild = 0
							Global $plat = 0, $raketeon = 0, $timerrakon = 0, $raketentimer = 0, $move = 0, $score = 0, $scoreplus = 0, $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)]


							$gruen_n[0][0] = 200
$gruen_n[1][0] = 150
For $n = 0 To UBound($gruen_n) - 1
	If (Not $n = 0 Or $n = 1) Then
		$gruen_n[$n][0] = Random(0, $Width - $Plat_Width, 1)
	EndIf
	$bAngle[$n] = 0
	$braunf[$n] = 0
	$gruen_n[$n][1] = 400 + ($n * $abstand) ;$abstand ist Negativ!!!!!!
	$gruen_n[$n][2] = 0
	$gruen_n[$n][3] = 0
Next

							$x = $gruen_n[0][0]
							$y = $Height - $Doodle_Height

							$die = False
							$t = 0
							$plat = 0
							$MoveSpeed = 0
							$move = 0
							$Platmovespeed = 0
							$platten = 0
							$score = 0
							$scoreplus = 0
							If $gruen_n[0][0] < 60 + $Doodle_Width And $gruen_n[0][0] + $Plat_Width > 60 + $Doodle_Width Then
								$x = $Width - 60
							Else
								$x = 60
							EndIf
							$paused = 0
							ExitLoop(2)

						Case $pos[0] > 98 And $pos[0] < 204 And $pos[1] > 275 And $pos[1] < 311
							_Start()
							ExitLoop(2)

					EndSelect
				EndIf
			Until $paused = 0
			EndIf


		_GDIPlus_GraphicsDrawImageRect($Graphic, $Bitmap, 0, 0, $Width, $Height)

		Until $paused = 0
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 = _GDIPlus_ImageGetHeight($Doodle_Rechts)
	$Doodle_Width = _GDIPlus_ImageGetWidth($Doodle_Rechts)
	$Platform_grau = $wPlatform_grau
	$Plat_Width = $wPlat_Width
	$DoodleRakl = $wDoodleRakl
	$DoodleRakr = $wDoodleRakr
	$Doodle_sf_gesch_l = $wDoodle_sf_gesch_l
	$Doodle_sf_gesch_r = $wDoodle_sf_gesch_r
	$Doodle_sf_l = $wDoodle_sf_l
	$Doodle_sf_r = $wDoodle_sf_r
	$Doodle_sf_gesch_Height = $wDoodle_sf_gesch_Height
	$Doodle_sf_Height = $wDoodle_sf_Height
		$Platform_braun1 = $wPlatform_braun1
		$Platform_braun2 = $wPlatform_braun2
		$Platform_gelb = $wPlatform_gelb
	$Platform_rot = $wPlatform_rot
	If $AktuellerDoodle = $Doodle_Links Then
		$AktuellerDoodle = $Doodle_Links
	Else
		$AktuellerDoodle = $Doodle_Rechts
	EndIf
	$wintermod = 1
EndFunc   ;==>_winter

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 = _GDIPlus_ImageGetHeight($Doodle_Rechts)
	$Doodle_Width = _GDIPlus_ImageGetWidth($Doodle_Rechts)
	$Platform_grau = $nPlatform_grau
	$Plat_Width = $nPlat_Width
	$DoodleRakl = $nDoodleRakl
	$DoodleRakr = $nDoodleRakr
	$Doodle_sf_gesch_l = $nDoodle_sf_gesch_l
	$Doodle_sf_gesch_r = $nDoodle_sf_gesch_r
	$Doodle_sf_l = $nDoodle_sf_l
	$Doodle_sf_r = $nDoodle_sf_r
	$Doodle_sf_gesch_Height = $nDoodle_sf_gesch_Height
	$Doodle_sf_Height = $nDoodle_sf_Height
	$Platform_braun1 = $nPlatform_braun1
	$Platform_braun2 = $nPlatform_braun2
	$Platform_gelb = $nPlatform_gelb
	$Platform_rot = $nPlatform_rot
	If $AktuellerDoodle = $Doodle_Links Then
		$AktuellerDoodle = $Doodle_Links
	Else
		$AktuellerDoodle = $Doodle_Rechts
	EndIf


	$wintermod = 0
EndFunc   ;==>_winteroff

Func _pause()

		If $paused = 0 Then
			$paused = 1
		Else
		$paused = 0
	EndIf


EndFunc   ;==>_pause

;~ 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




; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsRotateTransform
; Description ...: Updates the world transformation matrix of a Graphics object with the product of itself and a rotation matrix
; Syntax.........: _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle[, $iOrder = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                  $nAngle    - The angle, in degrees, of rotation
;                  $iOrder    - Order of matrices multiplication:
;                  |0 - The rotation matrix is on the left
;                  |1 - The rotation matrix is on the right
; Return values .: Success      - True
;                  Failure      - False and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: None
; Related .......: _GDIPlus_GraphicsMultiplyTransform
; Link ..........; @@MsdnLink@@ GdipRotateWorldTransform
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsRotateTransform($hGraphics, $nAngle, $iOrder = 0)
	Local $aResult = DllCall($ghGDIPDll, "uint", "GdipRotateWorldTransform", "hwnd", $hGraphics, "float", $nAngle, "int", $iOrder)

	If @error Then Return SetError(@error, @extended, False)
	$GDIP_STATUS = $aResult[0]
	Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsRotateTransform

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsResetTransform
; Description ...: Sets the world transformation matrix of a Graphics object to the identity matrix
; Syntax.........: _GDIPlus_GraphicsResetTransform($hGraphics)
; Parameters ....: $hGraphics - Pointer to a Graphics object
; Return values .: Success      - True
;                  Failure      - False and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: None
; Related .......: None
; Link ..........; @@MsdnLink@@ GdipResetWorldTransform
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsResetTransform($hGraphics)
	Local $aResult = DllCall($ghGDIPDll, "uint", "GdipResetWorldTransform", "hwnd", $hGraphics)

	If @error Then Return SetError(@error, @extended, False)
	$GDIP_STATUS = $aResult[0]
	Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsResetTransform

; #FUNCTION# ====================================================================================================================
; Name...........: _GDIPlus_GraphicsTranslateTransform
; Description ...: Updates a Graphics object's world transformation matrix with the product of itself and a translation matrix
; Syntax.........: _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY[, $iOrder = 0])
; Parameters ....: $hGraphics - Pointer to a Graphics object
;                  $nDX	  	  - Horizontal component of the translation
;                  $nDY	  	  - Vertical component of the translation
;                  $iOrder    - Order of matrices multiplication:
;                  |0 - The translation matrix is on the left
;                  |1 - The translation matrix is on the right
; Return values .: Success      - True
;                  Failure      - False and either:
;                  |@error and @extended are set if DllCall failed
;                  |$GDIP_STATUS contains a non zero value specifying the error code
; Remarks .......: None
; Related .......: None
; Link ..........; @@MsdnLink@@ GdipTranslateWorldTransform
; Example .......; No
; ===============================================================================================================================
Func _GDIPlus_GraphicsTranslateTransform($hGraphics, $nDX, $nDY, $iOrder = 0)
	Local $aResult = DllCall($ghGDIPDll, "uint", "GdipTranslateWorldTransform", "hwnd", $hGraphics, "float", $nDX, "float", $nDY, "int", $iOrder)

	If @error Then Return SetError(@error, @extended, False)
	$GDIP_STATUS = $aResult[0]
	Return $aResult[0] = 0
EndFunc   ;==>_GDIPlus_GraphicsTranslateTransform