Advertisement
FireDiver

PandaRunner Beta 1.1

Jul 25th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 28.24 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Icon=icon.ico
  3. #AutoIt3Wrapper_UseUpx=y
  4. #AutoIt3Wrapper_Res_Description=PandaRunner
  5. #AutoIt3Wrapper_Res_Fileversion=0.1.1.2
  6. #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
  7. #AutoIt3Wrapper_Res_LegalCopyright=Alle Rechte liegen bei FireDiver (yt/FireDiver)
  8. #AutoIt3Wrapper_Res_Language=1031
  9. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  10. #include "G:\A2D\A2D.au3"
  11. #include <Misc.au3>
  12. #include <Crypt.au3>
  13. #include <Array.au3>
  14. #include <Zip.au3>
  15. #include <INet.au3>
  16. #include <Math.au3>
  17. #include <GUIConstantsEx.au3>
  18. #include <StaticConstants.au3>
  19. #include <ButtonConstants.au3>
  20. #include <SliderConstants.au3>
  21. #include <WindowsConstants.au3>
  22. Opt("GUIOnEventMode", 1)
  23. $settingsform = GUICreate("Einstellungen", 314, 437, 192, 124, BitOR($WS_SYSMENU, $WS_POPUP))
  24. $Label1 = GUICtrlCreateLabel("Spielgeschwindigkeit", 8, 8, 131, 20)
  25. GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
  26. $Label2 = GUICtrlCreateLabel("Sollte nur umgestellt werden, wenn das Spiel unter 80 FPS", 8, 32, 279, 17)
  27. $Slider1 = GUICtrlCreateSlider(8, 72, 302, 29)
  28. GUICtrlSetLimit(-1, 15, 0)
  29. GUICtrlSetData(-1, 10)
  30. GUICtrlSetOnEvent(-1, "SliderMoved")
  31. $Label3 = GUICtrlCreateLabel("<-- Schneller", 16, 104, 63, 17)
  32. $Label4 = GUICtrlCreateLabel("10", 144, 104, 16, 17)
  33. $Label5 = GUICtrlCreateLabel("Langsamer -->", 232, 104, 71, 17)
  34. $Label6 = GUICtrlCreateLabel("oder über 130FPS läuft (10 ist Standard)", 8, 56, 193, 17)
  35. $Button1 = GUICtrlCreateButton("Übernehmen", 8, 400, 147, 25)
  36. GUICtrlSetOnEvent(-1, "ApplyPressed")
  37. $Button2 = GUICtrlCreateButton("Zurücksetzen", 160, 400, 147, 25)
  38. GUICtrlSetOnEvent(-1, "ResetPressed")
  39. $Label7 = GUICtrlCreateLabel("Cheats", 8, 200, 46, 20)
  40. GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
  41. $Label8 = GUICtrlCreateLabel("Bei allen Cheats ist das speichern der Highscore deaktiviert", 8, 224, 283, 17)
  42. $Checkbox1 = GUICtrlCreateCheckbox("Unbesiegbarkeit", 8, 240, 97, 17)
  43. GUICtrlSetOnEvent(-1, "InfLPressed")
  44. $Checkbox2 = GUICtrlCreateCheckbox("Unendlich Jumpboost", 8, 256, 121, 17)
  45. GUICtrlSetOnEvent(-1, "InfJPressed")
  46. $Checkbox3 = GUICtrlCreateCheckbox("Unendlich Speedboost", 8, 272, 129, 17)
  47. GUICtrlSetOnEvent(-1, "InfBPressed")
  48. $Checkbox4 = GUICtrlCreateCheckbox("Mond", 160, 240, 97, 17)
  49. GUICtrlSetOnEvent(-1, "MoonPressed")
  50. $Button3 = GUICtrlCreateButton("Auf Update prüfen", 8, 160, 99, 33)
  51. GUICtrlSetOnEvent(-1, "UpdatePressed")
  52. $Label9 = GUICtrlCreateLabel("Update", 8, 136, 49, 20)
  53. GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
  54. GUISetState(@SW_HIDE, $settingsform)
  55. If FileExists(@TempDir & "\pandar_upd.bat") Then FileDelete(@TempDir & "\pandar_upd.bat")
  56. If Not FileExists(@ScriptDir & "\Data") Then
  57.     SplashTextOn("Entpacke...", "Dateien werden Entpackt...", 200, 70)
  58.     FileInstall("G:\A2D\Panda\d.zip", @TempDir & "\panda_d.zip", 1)
  59.     _Zip_UnzipAll(@TempDir & "\panda_d.zip", @ScriptDir & "\", 1)
  60.     Sleep(7500) ;Nur zur Sicherheit
  61.     SplashOff()
  62. EndIf
  63. If not FileExists(@ScriptDir & "\Data\Images\rain.png") Then FileInstall("G:\A2D\Panda\Data\Images\rain.png",@ScriptDir & "\Data\Images\rain.png")
  64. If FileExists(@ScriptDir & "\Data\settings.ini") Then FileDelete(@ScriptDir & "\Data\settings.ini")
  65. Dim $gsp = 10, $anti_t, $lasttree = 1, $MaxTerrObj = 30, $TerrObj[1000][10], $hscore = 0, $injump = 0, $jumpvel = 0, $Step = 0, $t, $Gravity = 0.3, $MaxJumpVel, $bla, $score = 0, $standardJumpValue = 8, $OldJumpValue = 8, $pause = 0, $scorecount = 0, $StageSpeed = 5, $ExtraTerrActive = 0, $ExtraTerr
  66. Dim $Invincible = 0, $falling = 0, $Timer = 0, $OldStageSpeed, $SpawnSpeed = 1650, $panda_an = 0, $panda1, $LastGenerated = 0, $SPPOS[10], $Zahl, $lZahl = 0, $HighScore = 0, $HighScoreName = "", $line[10], $tree[10][10], $size[5], $SSpeed, $BossFight = 0
  67. Dim $down = 0, $pause = 0, $RemJump, $RemBoost, $panda_m = 3, $inm = 0, $p_enter = 0, $GameVersion = "Beta v1.1", $Active = 1, $baggerAn[6], $Bagger[6], $bosscount = 0, $ban = 1, $throw = 0, $tt, $bla2, $SGravity = 0.3, $Sjumpvel, $StoneX, $StoneY, $rev = 0, $laying = 0, $ll = 0
  68. Dim $RainY = -1300, $RainY2 = -1000, $RainH = 1300, $raining = 0, $rpf[100][100], $MaxRpf = 0, $rfall = 0,$infiniteBoost = 0,$infiniteJump = 0,$moon = 0
  69. $anti_t = Random(30, 90, 1)
  70. $HighScore = _A2D_Decrypt(@ScriptDir & "\Data\score.a2d")
  71. AdlibRegister("_Resize", 500)
  72. _A2D_Startup("PandaRunner", 900, 720, 900, 720, 2, 1, 5)
  73. $clear = _A2D_LoadImage(@ScriptDir & "\Data\Images\clear.jpg")
  74. $Logo = _A2D_LoadImage(@ScriptDir & "\Data\Images\BG.jpeg")
  75. _A2D_MapDraw($clear, 900, 720, 1)
  76. _A2D_DrawBitMap($Logo, 0, 0, 900, 720)
  77. _A2D_Buffer()
  78. For $count = 1 To 3 Step +1
  79.     Assign("panda" & $count, _A2D_LoadImage(@ScriptDir & "\Data\Images\panda\panda" & $count & ".jpg"))
  80. Next
  81. $hHsc = $HighScore * $anti_t
  82. $stone = _A2D_LoadImage(@ScriptDir & "\Data\Images\stone.png")
  83. $rain = _A2D_LoadImage(@ScriptDir & "\Data\Images\rain.png")
  84. $matsch = _A2D_LoadImage(@ScriptDir & "\Data\Images\matsch.jpg")
  85. $grass = _A2D_LoadImage(@ScriptDir & "\Data\Images\grass.jpg")
  86. $pandaj = _A2D_LoadImage(@ScriptDir & "\Data\Images\panda\pandaj.jpg")
  87. $pandab = _A2D_LoadImage(@ScriptDir & "\Data\Images\pandab.jpg")
  88. $boden = _A2D_LoadImage(@ScriptDir & "\Data\Images\boden.jpg")
  89. $jumpb = _A2D_LoadImage(@ScriptDir & "\Data\Images\jumpb.jpg")
  90. $schlucht = _A2D_LoadImage(@ScriptDir & "\Data\Images\schlucht.jpg")
  91. $tr_ex = _A2D_LoadImage(@ScriptDir & "\Data\Images\tr_ex.jpg")
  92. $tr1 = _A2D_LoadImage(@ScriptDir & "\Data\Images\tr1.jpg")
  93. $tr2 = _A2D_LoadImage(@ScriptDir & "\Data\Images\tr2.jpg")
  94. $size[1] = 550 * 0.5
  95. $size[2] = 550 * 0.5
  96. $size[3] = 550 * 0.5
  97. $size[4] = 250 * 0.5
  98. For $count = 1 To 5 Step +1
  99.     $baggerAn[$count] = _A2D_LoadImage(@ScriptDir & "\Data\Images\bagger\bagger" & $count & ".png")
  100. Next
  101. For $count = 1 To 4 Step +1
  102.     $tree[$count][0] = _A2D_LoadImage(@ScriptDir & "\Data\Images\tree" & $count & ".png")
  103.     $tree[$count][4] = $size[$count]
  104. Next
  105. _A2D_ObjCreate($panda1, 100, 380, 25, 50, "Panda")
  106. _A2D_ObjStatus("Panda", 1)
  107. $Bagger[1] = 540 ;X
  108. $Bagger[2] = 157 ;Y
  109. $Bagger[3] = 350 ;Width
  110. $Bagger[4] = 300 ;Height
  111. _A2D_ObjCreate($baggerAn[1], $Bagger[1], $Bagger[2], $Bagger[3], $Bagger[4], "Bagger")
  112. _A2D_ObjStatus("Bagger", 1)
  113. $PandaW = 25
  114. $PandaH = 50
  115. $PandaX = 100
  116. $PandaY = 380
  117. For $count = 1 To 4 Step +1
  118.     $tree[$count][2] = $count * 1000
  119. Next
  120. ;Sleep(5000)
  121. _GenTerrain()
  122. $hDLL = DllOpen("user32.dll")
  123. AdlibRegister("_GenTerrain", $SpawnSpeed)
  124. ;AdlibRegister("_Animate", 100)
  125. $running = 0
  126. $ch = 1
  127. HotKeySet("{ESC}", "_go")
  128. ;_Boss()
  129. Func _pause()
  130.     If $running = 0 Or $falling = 1 Then Return -1
  131.     Switch $pause
  132.         Case 0
  133.             AdlibUnRegister("_GenTerrain")
  134.             $OldStageSpeed = $StageSpeed
  135.             $StageSpeed = 0
  136.             $pause = 1
  137.         Case 1
  138.             $StageSpeed = $OldStageSpeed
  139.             $pause = 0
  140.             AdlibRegister("_GenTerrain", $SpawnSpeed)
  141.     EndSwitch
  142. EndFunc   ;==>_pause
  143. Func _stopboost()
  144.     If $infiniteBoost = 0 Then $RemBoost -= 10
  145.     If $RemBoost = 0 Then
  146.         $StageSpeed = $OldStageSpeed
  147.         $Invincible = 0
  148.         AdlibRegister("_GenTerrain", $SpawnSpeed)
  149.         AdlibUnRegister("_stopgen")
  150.         AdlibUnRegister("_stopboost")
  151.     EndIf
  152. EndFunc   ;==>_stopboost
  153. Func _stopgen()
  154.     AdlibUnRegister("_GenTerrain")
  155. EndFunc   ;==>_stopgen
  156. Func _jump()
  157.     If $injump = 1 Then Return -1
  158.     $t = 0
  159.     $bla = 0
  160.     $injump = 1
  161.     $jumpvel = $standardJumpValue
  162.     ;$Gravity = 0.3
  163. EndFunc   ;==>_jump
  164. Func _Difference($1, $2)
  165.     If $1 > $2 Then
  166.         Return $1 - $2
  167.     ElseIf $2 > $1 Then
  168.         Return $2 - $1
  169.     ElseIf $2 = $1 Then
  170.         Return 0
  171.     EndIf
  172. EndFunc   ;==>_Difference
  173. Func _ReCalcDistance()
  174.     $oX = Random(901, 2901, 1)
  175.     $exit = 0
  176.     While $exit = 0
  177.         $n = 0
  178.         For $tcount = 1 To $MaxTerrObj Step +1
  179.             Switch $TerrObj[$tcount][0]
  180.                 Case 1 To 5
  181.                     If _Difference($oX, $TerrObj[$tcount][1]) < 60 And _Difference($oX, $TerrObj[$tcount][1] + $TerrObj[$tcount][2]) < 60 Then
  182.                         $oX = Random(901, 2901, 1)
  183.                         $n = 1
  184.                     EndIf
  185.             EndSwitch
  186.         Next
  187.         If $n = 0 Then
  188.             Return $oX
  189.         EndIf
  190.     WEnd
  191. EndFunc   ;==>_ReCalcDistance
  192. Func _CheckType($tp)
  193.     Switch $tp
  194.         Case 1 To 10
  195.             Return 2
  196.         Case Else
  197.             Return 1
  198.     EndSwitch
  199. EndFunc   ;==>_CheckType
  200. Func _TerrCreate($bm, $y, $w, $h, $it, $t, $e1)
  201.     $oX = _ReCalcDistance()
  202.     For $tcount = 1 To $MaxTerrObj Step +1
  203.         If _CheckType($TerrObj[$tcount][0]) = 1 Then
  204.             If $TerrObj[$tcount][0] = -1 Then
  205.                 _A2D_ObjUpdate("tr" & $tcount, $bm, $oX, $y, $w, $h, $t, $e1, $tcount)
  206.                 _A2D_ObjStatus("tr" & $tcount, 1)
  207.             Else
  208.                 _A2D_ObjCreate($bm, $oX, $y, $w, $h, "tr" & $tcount, $t, $e1, $tcount)
  209.                 _A2D_ObjStatus("tr" & $tcount, 1)
  210.             EndIf
  211.             $TerrObj[$tcount][0] = $it
  212.             $TerrObj[$tcount][1] = $oX
  213.             $TerrObj[$tcount][2] = $w ;width
  214.             $TerrObj[$tcount][3] = $h ;height
  215.             $TerrObj[$tcount][4] = $y ;y
  216.             ExitLoop
  217.         EndIf
  218.     Next
  219. EndFunc   ;==>_TerrCreate
  220. Func _idle()
  221.     $Active = 0
  222.     Do
  223.         If WinGetState("PandaRunner") = 5 Then
  224.             _A2D_Shutdown()
  225.             Exit
  226.         EndIf
  227.         Sleep(100)
  228.     Until WinActive("PandaRunner")
  229.     $Active = 1
  230. EndFunc   ;==>_idle
  231. Func _Resize()
  232.     If Not WinActive("PandaRunner") Then _idle()
  233.     $size2 = WinGetClientSize("PandaRunner")
  234.     If $size2[0] <> 900 Or $size2[1] <> 720 Then
  235.         $pos = WinGetPos("PandaRunner")
  236.         WinMove("PandaRunner", "", $pos[0], $pos[1], 900, 720)
  237.     EndIf
  238. EndFunc   ;==>_Resize
  239. Func _GenTerrain()
  240.     If Not WinActive("PandaRunner") Then _idle()
  241.     If Random(1, 3, 1) = 1 Then ;Bäume
  242.         $oX = Random(901, 2901, 1)
  243.         $exit = 0
  244.         While $exit = 0
  245.             $n = 0
  246.             For $count = 1 To 4 Step +1
  247.                 If $tree[$count][1] = 1 And _Difference($oX, $tree[$count][2]) < 250 Then
  248.                     $oX = Random(901, 2901, 1)
  249.                     $n = 1
  250.                 ElseIf $count = 4 And $n = 0 Then
  251.                     $exit = 1
  252.                 EndIf
  253.             Next
  254.         WEnd
  255.         $lasttree = $oX
  256.         For $count = 1 To 4 Step +1
  257.             If $tree[$count][1] <> 1 Then
  258.                 $tree[$count][1] = 1
  259.                 $tree[$count][2] = $oX
  260.                 ExitLoop
  261.             EndIf
  262.         Next
  263.     EndIf
  264.     If Random(1, 30, 1) = 1 Then ;Speedboost
  265.         _TerrCreate($tr_ex, 400, 23, 30, 2, 2, 2)
  266.     EndIf
  267.     If Random(1, 20, 1) = 1 Then ;JumpBoost
  268.         _TerrCreate($jumpb, 400, 23, 30, 5, 2, 2)
  269.     EndIf
  270.     If Random(1, 3, 1) = 1 Then ;Babypandas
  271.         _TerrCreate($pandab, 400, 23, 30, 3, 2, 3)
  272.     EndIf
  273.     If Random(1, 20, 1) = 1 And $raining = 0 And $rfall = 0 Then ;Regen
  274.         $rfall = 1
  275.         $raining = 1
  276.         $RainY = -1600
  277.         $RainY2 = -1600
  278.         AdlibRegister("_disRain", Random(8000, 20000, 1))
  279.     EndIf
  280.     If Random(1, 5, 1) = 1 Then ;Schlucht
  281.         $oX = _ReCalcDistance()
  282.         For $tcount = 1 To $MaxTerrObj Step +1
  283.             If _CheckType($TerrObj[$tcount][0]) = 1 Then
  284.                 If $TerrObj[$tcount][0] = -1 Then
  285.                     _A2D_ObjUpdate("tr" & $tcount, $schlucht, $oX, 430, 75, 290, 2, 1, $tcount)
  286.                     _A2D_ObjStatus("tr" & $tcount, 1)
  287.                 Else
  288.                     _A2D_ObjCreate($schlucht, $oX, 430, 75, 290, "tr" & $tcount, 2, 1, $tcount)
  289.                     _A2D_ObjStatus("tr" & $tcount, 1)
  290.                 EndIf
  291.                 $TerrObj[$tcount][0] = 4
  292.                 $TerrObj[$tcount][1] = $oX + ($PandaW - 1) ;x + pandawidth
  293.                 $TerrObj[$tcount][2] = 75 - ($PandaW - 1);width - pandawidth
  294.                 $TerrObj[$tcount][3] = 290 ;height
  295.                 $TerrObj[$tcount][4] = 429 ;y
  296.                 ExitLoop
  297.             EndIf
  298.         Next
  299.     EndIf
  300.     If Random(1, 2, 1) = 1 And $raining = 1 Then ;Matsch
  301.         _TerrCreate($matsch, 429, 75, 10, 6, 2, 3)
  302.     EndIf
  303.     $NorTerr = Random(1, 2, 1) ;Hindernis
  304.     _TerrCreate(Eval("tr" & $NorTerr), 400, 23, 30, 1, 2, 1)
  305. EndFunc   ;==>_GenTerrain
  306. Func _MoveTerrain()
  307.     For $count = 1 To 4 Step +1
  308.         If $tree[$count][1] = 1 Then
  309.             If $tree[$count][2] >= ($tree[$count][4] * -1) Then
  310.                 $tree[$count][2] -= $StageSpeed
  311.                 ;ConsoleWrite(@CRLF & $count)
  312.                 _A2D_DrawBitMap($tree[$count][0], $tree[$count][2], 120, $tree[$count][4], 330);$tree[$count][3],$tree[$count][4])
  313.             Else
  314.                 $tree[$count][1] = -1
  315.             EndIf
  316.         EndIf
  317.     Next
  318.     $gx = 0
  319.     ;For $count = 1 to 18 Step +1
  320.     _A2D_DrawBitMap($grass, 0, 410, 900, 20)
  321.     ;$gx += 50
  322.     ;Next
  323.     For $count = 1 To $MaxTerrObj Step +1
  324.         If $TerrObj[$count][0] >= 1 And $TerrObj[$count][0] <> 4 And $TerrObj[$count][0] <> 6 Then
  325.             If $TerrObj[$count][1] > -150 Then
  326.                 $TerrObj[$count][1] -= $StageSpeed
  327.                 _A2D_ObjDraw("tr" & $count, 1, $TerrObj[$count][1], $TerrObj[$count][4], $TerrObj[$count][2], $TerrObj[$count][3], 2, $TerrObj[$count][0], $count)
  328.             Else
  329.                 _A2D_ObjStatus("tr" & $count, -1)
  330.                 $TerrObj[$count][0] = -1
  331.             EndIf
  332.         EndIf
  333.     Next
  334.     If $raining = 1 Then
  335.         _Rain()
  336.     ElseIf $raining = 0 And $RainY >= -1200 And $RainY <= 430 Then
  337.         $RainY += 5
  338.         $RainY2 += 5
  339.         _Rain()
  340.     Else
  341.         $rfall = 0
  342.     EndIf
  343.     _A2D_DrawBitMap($boden, 0, 430, 900, 290)
  344.     For $count = 1 To $MaxTerrObj Step +1
  345.         If $TerrObj[$count][0] = 4 Then
  346.             If $TerrObj[$count][1] > -150 Then
  347.                 $TerrObj[$count][1] -= $StageSpeed
  348.                 _A2D_ObjUpdate("tr" & $count, $schlucht, $TerrObj[$count][1], $TerrObj[$count][4], $TerrObj[$count][2] - ($PandaW + 1), $TerrObj[$count][3], 2, $TerrObj[$count][0], $count)
  349.                 _A2D_DrawBitMap($schlucht, $TerrObj[$count][1] - ($PandaW - 1), $TerrObj[$count][4] + 1, $TerrObj[$count][2] + ($PandaW + 1), $TerrObj[$count][3])
  350.             Else
  351.                 _A2D_ObjStatus("tr" & $count, -1)
  352.                 $TerrObj[$count][0] = -1
  353.             EndIf
  354.         ElseIf $TerrObj[$count][0] = 6 Then
  355.             If $TerrObj[$count][1] > -150 Then
  356.                 $TerrObj[$count][1] -= $StageSpeed
  357.                 _A2D_ObjDraw("tr" & $count, 1, $TerrObj[$count][1], $TerrObj[$count][4], $TerrObj[$count][2], $TerrObj[$count][3], 2, $TerrObj[$count][0], $count)
  358.             Else
  359.                 _A2D_ObjStatus("tr" & $count, -1)
  360.                 $TerrObj[$count][0] = -1
  361.             EndIf
  362.         EndIf
  363.     Next
  364.     If $injump = 1 And $running = 1 Then
  365.         _A2D_ObjDraw("Panda", 1, $PandaX, $PandaY, $PandaW, $PandaH, 1, 0, 0, $pandaj)
  366.     ElseIf $running = 1 Then
  367.         _A2D_ObjDraw("Panda", 1, $PandaX, $PandaY, $PandaW, $PandaH, 1, 0, 0, Eval("panda" & $panda_an))
  368.         If $panda_an >= 3 Then $panda_an = 0
  369.     EndIf
  370. EndFunc   ;==>_MoveTerrain
  371. Func _FallAn()
  372.     $PandaY += 10
  373.     If $PandaY > 720 Then
  374.         _Die()
  375.         AdlibUnRegister("_FallAn")
  376.     EndIf
  377. EndFunc   ;==>_FallAn
  378. Func _Die()
  379.     _CheckHS()
  380.     AdlibUnRegister("_Animate")
  381.     AdlibUnRegister("_stopgen")
  382.     AdlibUnRegister("_stopboost")
  383.     AdlibUnRegister("_DisJump")
  384.     If $moon = 0 Then $Gravity = 0.3
  385.     $RemJump = 0
  386.     $PandaH = 50
  387.     $PandaY = 380
  388.     $RemBoost = 0
  389.     $running = 0
  390.     $bosscount = 0
  391.     $scorecount = 0
  392.     $PandaX = 100
  393.     $falling = 0
  394.     $standardJumpValue = $OldJumpValue
  395.     AdlibUnRegister("_GenTerrain")
  396.     AdlibRegister("_GenTerrain", $SpawnSpeed)
  397. EndFunc   ;==>_Die
  398. Func _CheckHS()
  399.     If $Invincible = 1 or $moon = 1 or $infiniteBoost = 1 or $infiniteJump = 1 Then Return -1
  400.     If $score > $HighScore Then
  401.         If $hscore / $anti_t <> $score Or $hHsc / $anti_t <> $HighScore Then
  402.             MsgBox(64, "Info", "Nice Hax but no", 5)
  403.             Exit
  404.         EndIf
  405.         _A2D_Encrypt($score, @ScriptDir & "\Data\score.a2d")
  406.         $HighScore = $score
  407.         $hHsc = $HighScore * $anti_t
  408.     EndIf
  409. EndFunc   ;==>_CheckHS
  410. Func _CollCheck()
  411.     $collnum = _A2D_CCollision("objM:single", 0, 2, $PandaX, $PandaY, $PandaW, $PandaH)
  412.     If $Invincible = 1 Then Return -1
  413.     If $StageSpeed <> 12 And $collnum <> 6 And $inm = 1 Then
  414.         $StageSpeed = 5
  415.         $panda_m = 3
  416.         $inm = 0
  417.     EndIf
  418.     Switch $TerrObj[$collnum][0]
  419.         Case 1
  420.             ;ConsoleWrite(@CRLF & "COL: " & $Timer)
  421.             _Die()
  422.         Case 2
  423.             $OldStageSpeed = $StageSpeed
  424.             $StageSpeed = 12
  425.             $Invincible = 1;$BegInvincible
  426.             $ExtraTerrActive = 0
  427.             AdlibRegister("_stopgen", 2000)
  428.             $RemBoost = 4000
  429.             AdlibRegister("_stopboost", 10)
  430.             $collnum = 0
  431.             Return
  432.         Case 3
  433.             $TerrObj[$collnum][0] = -1
  434.             _A2D_ObjStatus("tr" & $collnum, -1)
  435.             $score += 100
  436.             $scorecount += 100
  437.             $hscore += $anti_t * 100
  438.             _A2D_ObjUpdate("tr" & $collnum, 0)
  439.             $collnum = 0
  440.             Return
  441.         Case 4
  442.             AdlibUnRegister("_GenTerrain")
  443.             AdlibUnRegister("_Animate")
  444.             AdlibRegister("_FallAn", 10)
  445.             $falling = 1
  446.             While 1
  447.                 $start_tt = @MSEC
  448.                 If $running = 0 Then
  449.                     $PandaY = 380
  450.                     ExitLoop
  451.                 EndIf
  452.                 _A2D_MapDraw($clear, 900, 430, 1)
  453.                 For $count = 1 To 4 Step +1
  454.                     If $tree[$count][1] = 1 Then
  455.                         _A2D_DrawBitMap($tree[$count][0], $tree[$count][2], 120, $tree[$count][4], 330)
  456.                     EndIf
  457.                 Next
  458.                 _A2D_DrawBitMap($grass, 0, 410, 900, 20)
  459.                 _A2D_DrawBitMap($boden, 0, 430, 900, 290)
  460.                 For $count = 1 To $MaxTerrObj Step +1
  461.                     If $TerrObj[$count][0] >= 1 And $TerrObj[$count][0] <> 4 Then
  462.                         _A2D_ObjDraw("tr" & $count)
  463.                     ElseIf $TerrObj[$count][0] = 4 Then
  464.                         _A2D_DrawBitMap($schlucht, $TerrObj[$count][1] - ($PandaW - 1), $TerrObj[$count][4] + 1, $TerrObj[$count][2] + ($PandaW + 1), $TerrObj[$count][3])
  465.                     EndIf
  466.                 Next
  467.                 _A2D_ObjDraw("Panda", 1, $PandaX, $PandaY, $PandaW, $PandaH, 1, 0, 0, Eval("panda" & $panda_an))
  468.                 _A2D_DrawString("Punkte: " & $score, 30, 650, 30)
  469.                 _A2D_DrawString("Highscore: " & $HighScore, 30, 650, 50)
  470.                 _A2D_FPS()
  471.                 _A2D_Buffer()
  472.                 Sleep(10)
  473.             WEnd
  474.         Case 5 ;JumpBoost
  475.             ;ConsoleWrite("go")
  476.             $TerrObj[$collnum][0] = -1
  477.             _A2D_ObjStatus("tr" & $collnum, -1)
  478.             _A2D_ObjUpdate("tr" & $collnum, 0)
  479.             $collnum = 0
  480.             $OldJumpValue = $standardJumpValue
  481.             $standardJumpValue = 11
  482.             If $moon = 0 Then $Gravity = 0.3
  483.             $RemJump = 10000
  484.             AdlibRegister("_DisJump", 10)
  485.         Case 6 ;Matsch
  486.             $StageSpeed = 2
  487.             $panda_m = 1.5
  488.             $inm = 1
  489.     EndSwitch
  490. EndFunc   ;==>_CollCheck
  491. Func _DisJump()
  492.     If $infiniteJump = 0 Then $RemJump -= 10
  493.     If $RemJump = 0 Then
  494.         $standardJumpValue = 7
  495.         If $moon = 0 Then $Gravity = 0.3
  496.         AdlibUnRegister("_DisJump")
  497.     EndIf
  498. EndFunc   ;==>_DisJump
  499. Func _Animate()
  500.     ;If $pause = 1 Then Return -1
  501.     $panda_an += 1
  502. EndFunc   ;==>_Animate
  503. HotKeySet("{UP}", "_up")
  504. HotKeySet("{DOWN}", "_down")
  505. HotKeySet("{ENTER}", "_enter")
  506. Func _up()
  507.     If $running = 1 Or $Active = 0 Then Return -1
  508.     If $ch > 1 Then $ch -= 1
  509. EndFunc   ;==>_up
  510. Func _down()
  511.     If $running = 1 Or $Active = 0 Then Return -1
  512.     If $ch < 4 Then $ch += 1
  513. EndFunc   ;==>_down
  514. Func ApplyPressed()
  515.     $gsp = GUICtrlRead($Slider1)
  516.     GUISetState(@SW_HIDE, $settingsform)
  517.     $sloop = 0
  518. EndFunc   ;==>ApplyPressed
  519. Func ResetPressed()
  520.     GUICtrlSetData($Slider1, 10)
  521.     $gsp = 10
  522. EndFunc   ;==>ResetPressed
  523. Func UpdatePressed()
  524.     $source = _INetGetSource("http://firediver.bplaced.net/PandaRunner/vs.php")
  525.     $SoSplit = StringSplit($source, "|")
  526.     If @error Then
  527.         MsgBox(16, "Fehler", "Fehler beim Lesen der Antwort!")
  528.     Else
  529.         If $GameVersion <> $SoSplit[1] Then
  530.             $choice = MsgBox(4, "Info", $SoSplit[2])
  531.             If $choice = 6 Then
  532.                 ShellExecute("www.firediver.bplaced.net/PandaRunner/Patchnotes.txt")
  533.             EndIf
  534.             SplashTextOn("Info", "Update wird heruntergeladen...", 300, 150)
  535.             InetGet("http://firediver.bplaced.net/PandaRunner/upd.exe", @TempDir & "\upd_pr.exe")
  536.             SplashOff()
  537.             If Not FileExists(@TempDir & "\pandar_upd.bat") Then
  538.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "@echo off")
  539.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "echo Bitte warten...")
  540.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "ping -n 04 localhost>nul")
  541.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "MOVE /Y upd_pr.exe " & @ScriptDir & "\PandaRunner.exe")
  542.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "echo Update erfolgreich beendet!")
  543.                 FileWriteLine(@TempDir & "\pandar_upd.bat", "ping -n 10 localhost>nul")
  544.                 ShellExecute(@TempDir & "\pandar_upd.bat", "", @TempDir)
  545.                 Exit
  546.             EndIf
  547.         Else
  548.             MsgBox(64, "Info", "PandaRunner ist auf dem neuestem stand! (" & $GameVersion & ")")
  549.         EndIf
  550.     EndIf
  551. EndFunc   ;==>UpdatePressed
  552. Func SliderMoved()
  553.     GUICtrlSetData($Label4,GUICtrlRead($Slider1))
  554. EndFunc
  555. Func InfLPressed()
  556.     If $Invincible = 0 Then
  557.         $Invincible = 1
  558.     Else
  559.         $Invincible = 0
  560.     EndIf
  561. EndFunc
  562. Func InfJPressed()
  563.     If $infiniteJump = 0 Then
  564.         $infiniteJump = 1
  565.     Else
  566.         $infiniteJump = 0
  567.     EndIf
  568. EndFunc
  569. Func InfBPressed()
  570.     If $infiniteBoost = 0 Then
  571.         $infiniteBoost = 1
  572.     Else
  573.         $infiniteBoost = 0
  574.     EndIf
  575. EndFunc
  576. Func MoonPressed()
  577.     If $moon = 0 Then
  578.         $Gravity = 0.1
  579.         $SGravity = 0.1
  580.         $moon = 1
  581.     Else
  582.         $Gravity = 0.3
  583.         $SGravity = 0.3
  584.         $moon = 0
  585.     EndIf
  586. EndFunc
  587. Func _enter()
  588.     ;ConsoleWrite(@CRLF & $p_enter & @CRLF & $Active)
  589.     If $running = 1 Or $Active = 0 Then Return -1
  590.     If $p_enter = 1 Then
  591.         Return -1
  592.     Else
  593.         $p_enter = 1
  594.     EndIf
  595.     ;ConsoleWrite("a")
  596.     Switch $ch
  597.         Case 1
  598.             $standardJumpValue = $OldJumpValue
  599.             $score = 0
  600.             $hscore = 0
  601.             $bosscount = 0
  602.             $panda_an = 0
  603.             $StageSpeed = 5
  604.             For $tcount = 1 To $MaxTerrObj Step +1
  605.                 If $TerrObj[$tcount][0] >= 1 Then
  606.                     $TerrObj[$tcount][0] = -1
  607.                 EndIf
  608.             Next
  609.             For $treec = 1 To 4 Step +1
  610.                 $tree[$treec][1] = -1
  611.             Next
  612.             $running = 1
  613.             ;AdlibRegister("_Animate", 100)
  614.         Case 2
  615.             MsgBox(64, "Info", "Funktion noch in Entwicklung")
  616.         Case 3
  617.             GUICtrlSetData($Slider1, $gsp)
  618.             If $moon = 1 Then GUICtrlSetState($Checkbox4,$GUI_CHECKED)
  619.             If $infiniteBoost = 1 Then GUICtrlSetState($Checkbox3,$GUI_CHECKED)
  620.             If $infiniteJump = 1 Then GUICtrlSetState($Checkbox2,$GUI_CHECKED)
  621.             If $Invincible = 1 Then GUICtrlSetState($Checkbox1,$GUI_CHECKED)
  622.             GUISetState(@SW_SHOW, $settingsform)
  623.         Case 4
  624.             _A2D_Shutdown()
  625.             Exit
  626.     EndSwitch
  627.     $p_enter = 0
  628. EndFunc   ;==>_enter
  629. Func _MoveBossTerrain()
  630.     For $count = 1 To 4 Step +1
  631.         If $tree[$count][1] = 1 Then
  632.             If $tree[$count][2] >= ($tree[$count][4] * -1) Then
  633.                 ;ConsoleWrite(@CRLF & $count)
  634.                 _A2D_DrawBitMap($tree[$count][0], $tree[$count][2], 120, $tree[$count][4], 330);$tree[$count][3],$tree[$count][4])
  635.             EndIf
  636.         EndIf
  637.     Next
  638.     _A2D_DrawBitMap($grass, 0, 410, 900, 20)
  639.     _A2D_DrawBitMap($boden, 0, 430, 900, 290)
  640. EndFunc   ;==>_MoveBossTerrain
  641. Func _go()
  642.     AdlibRegister("_throwAN", 50)
  643. EndFunc   ;==>_go
  644. Func _throwAN()
  645.     If $ban = 5 Then $rev = 1
  646.     If $ban = 1 And $rev = 1 Then
  647.         $rev = 0
  648.         AdlibUnRegister("_throwAN")
  649.     EndIf
  650.     If $rev = 0 Then
  651.         $ban += 1
  652.         $StoneX += 1
  653.         $StoneY -= 10
  654.     ElseIf $rev = 1 Then
  655.         $ban -= 1
  656.     EndIf
  657.     If $ban = 3 And $ll = 0 Then _throw()
  658. EndFunc   ;==>_throwAN
  659. Func _throw()
  660.     $ll = 1
  661.     $tt = 0
  662.     $Sjumpvel = Random(12, 17)
  663.     ;$SGravity = 0.3
  664.     $bla2 = 0
  665.     $StoneY = 380
  666.     $SSpeed = Random(5, 10)
  667.     $throw = 1
  668.     $StoneX = 513
  669. EndFunc   ;==>_throw
  670. Func _Boss()
  671.     AdlibUnRegister("_Animate")
  672.     AdlibUnRegister("_GenTerrain")
  673.     $BossFight = 1
  674.     $StoneX = 513
  675.     $PandaX = 100
  676.     $RemBoost = 0
  677.     $RemJump = 0
  678.     $standardJumpValue = $OldJumpValue
  679.     $StoneY = 380
  680.     $StimeM = Random(1500, 3500, 1)
  681.     $StimeC = 0
  682.     $throwed = 0
  683.     While $BossFight = 1
  684.         If $throwed = 5 Then
  685.             $PandaH = 50
  686.             For $tcount = 1 To $MaxTerrObj Step +1
  687.                 If $TerrObj[$tcount][0] >= 1 Then
  688.                     $TerrObj[$tcount][0] = -1
  689.                 EndIf
  690.             Next
  691.             $PandaY = 380
  692.             AdlibRegister("_GenTerrain", $SpawnSpeed)
  693.             $BossFight = 0
  694.             Return 1
  695.         EndIf
  696.         Sleep($gsp)
  697.         ;ConsoleWrite(@CRLF & "C:" & $StimeC & " M:" & $StimeM)
  698.         $StimeC += 10
  699.         If $StimeC >= $StimeM Then
  700.             $StimeM = Random(1500, 3500)
  701.             $StimeC = 0
  702.             $laying = 0
  703.             AdlibRegister("_throwAN", 50)
  704.         EndIf
  705.         If _IsPressed("26", $hDLL) Then _jump()
  706.         If _IsPressed("25", $hDLL) Then
  707.             If $PandaX - $panda_m > 3 Then
  708.                 $PandaX -= $panda_m ;links
  709.             EndIf
  710.         EndIf
  711.         If _IsPressed("27", $hDLL) Then
  712.             If $PandaX + $panda_m < 220 Then
  713.                 $panda_an += 1
  714.                 $PandaX += $panda_m ;rechts
  715.             EndIf
  716.         EndIf
  717.         If _IsPressed("28", $hDLL) Then
  718.             $PandaH = 25
  719.             If $injump = 1 Then
  720.                 If $down = 0 Then $PandaY += 25
  721.                 If $moon = 0 Then $Gravity = 0.5
  722.                 $down = 1
  723.             Else
  724.                 $PandaY = 405
  725.             EndIf
  726.         ElseIf $PandaH <> 50 Then
  727.             $down = 0
  728.             $PandaH = 50
  729.             $PandaY = 380
  730.         EndIf
  731.         _A2D_MapDraw($clear, 900, 430, 1)
  732.         If $throw = 1 Then
  733.             If $StoneY >= 380 And $tt >= 0.10 Then
  734.                 $laying += 1
  735.                 $StoneY = 380
  736.                 If $laying = 40 Then
  737.                     $throw = 0
  738.                     $ll = 0
  739.                     $throwed += 1
  740.                     $StoneX = 513
  741.                 EndIf
  742.             ElseIf $laying = 0 Then
  743.                 $tt += 0.10
  744.                 $StoneX = $StoneX - $SSpeed
  745.                 $StoneY -= $Sjumpvel * $tt
  746.                 $Sjumpvel -= $SGravity * $tt
  747.                 If $Sjumpvel < 0 And $bla2 = 0 Then
  748.                     $bla2 = 1
  749.                     $tt = -0.5
  750.                     $Sjumpvel = 0
  751.                 Else
  752.                     $Sjumpvel -= $SGravity * $tt
  753.                 EndIf
  754.                 If _A2D_CCollision("custom", 0, 0, $PandaX, $PandaY, $PandaW, $PandaH, $StoneX, $StoneY, 50, 50) And $Invincible = 0 Then
  755.                     AdlibRegister("_GenTerrain", $SpawnSpeed)
  756.                     $BossFight = 0
  757.                     $ll = 0
  758.                     _Die()
  759.                     Return 1
  760.                 EndIf
  761.             EndIf
  762.         EndIf
  763.         If $injump = 1 Then
  764.             $t += 0.08
  765.             $PandaY -= $jumpvel * $t
  766.             $jumpvel -= $Gravity * $t
  767.             If $jumpvel < 0 And $bla = 0 Then
  768.                 $bla = 1
  769.                 $t = -0.5
  770.                 $jumpvel = 0
  771.             Else
  772.                 $jumpvel -= $Gravity * $t
  773.             EndIf
  774.             If Not $down = 1 And $PandaY >= 380 Then
  775.                 $PandaY = 380
  776.                 $injump = 0
  777.             ElseIf $down = 1 And $PandaY >= 405 Then
  778.                 $PandaY = 405
  779.                 $injump = 0
  780.             EndIf
  781.         EndIf
  782.         _MoveBossTerrain()
  783.         _A2D_ObjDraw("Bagger", 1, $Bagger[1], $Bagger[2], $Bagger[3], $Bagger[4], 2, 0, 0, $baggerAn[$ban])
  784.         If $injump = 1 Then
  785.             _A2D_ObjDraw("Panda", 1, $PandaX, $PandaY, $PandaW, $PandaH, 1, 0, 0, $pandaj)
  786.         Else
  787.             _A2D_ObjDraw("Panda", 1, $PandaX, $PandaY, $PandaW, $PandaH, 1, 0, 0, Eval("panda" & $panda_an))
  788.             If $panda_an >= 3 Then $panda_an = 0
  789.         EndIf
  790.         _A2D_DrawBitMap($stone, $StoneX, $StoneY, 50, 50)
  791.         _A2D_DrawString("Punkte: " & $score, 30, 650, 30)
  792.         _A2D_DrawString("Highscore: " & $HighScore, 30, 650, 50)
  793.         _A2D_DrawString($GameVersion, 10, 2, 718)
  794.         _A2D_FPS()
  795.         _A2D_Buffer()
  796.     WEnd
  797. EndFunc   ;==>_Boss
  798. Func _Rain()
  799.     If $raining = 1 Then
  800.         If $RainY > 0 Then
  801.             $RainY = -450
  802.         Else
  803.             $RainY += 5
  804.         EndIf
  805.         If $RainY2 > 0 Then
  806.             $RainY2 = -450
  807.         Else
  808.             $RainY2 += 5
  809.         EndIf
  810.     EndIf
  811.     _A2D_DrawBitMap($rain, 0, $RainY, 100, $RainH)
  812.     _A2D_DrawBitMap($rain, 100, $RainY2, 100, $RainH)
  813.     _A2D_DrawBitMap($rain, 200, $RainY, 100, $RainH)
  814.     _A2D_DrawBitMap($rain, 300, $RainY2, 100, $RainH)
  815.     _A2D_DrawBitMap($rain, 400, $RainY, 100, $RainH)
  816.     _A2D_DrawBitMap($rain, 500, $RainY2, 100, $RainH)
  817.     _A2D_DrawBitMap($rain, 600, $RainY, 100, $RainH)
  818.     _A2D_DrawBitMap($rain, 700, $RainY2, 100, $RainH)
  819.     _A2D_DrawBitMap($rain, 800, $RainY, 100, $RainH)
  820.     ;_A2D_DrawBitMap($rain,00,$RainY2,100,$RainH)
  821. EndFunc   ;==>_Rain
  822. Func _disRain()
  823.     $raining = 0
  824.     AdlibUnRegister("_disRain")
  825. EndFunc   ;==>_disRain
  826. Func _Draw()
  827.     _A2D_MapDraw($clear, 900, 430, 1)
  828.     If $injump = 1 Then
  829.         $t += 0.08
  830.         $PandaY -= $jumpvel * $t
  831.         $jumpvel -= $Gravity * $t
  832.         If $jumpvel < 0 And $bla = 0 Then
  833.             $bla = 1
  834.             $t = -0.5
  835.             $jumpvel = 0
  836.         Else
  837.             $jumpvel -= $Gravity * $t
  838.         EndIf
  839.         If Not $down = 1 And $PandaY >= 380 Then
  840.             $PandaY = 380
  841.             $injump = 0
  842.         ElseIf $down = 1 And $PandaY >= 405 Then
  843.             $PandaY = 405
  844.             $injump = 0
  845.         EndIf
  846.     EndIf
  847.     If $running = 1 Then _CollCheck()
  848.     _MoveTerrain()
  849.     _A2D_DrawString("Punkte: " & $score, 30, 650, 30)
  850.     _A2D_DrawString("Highscore: " & $HighScore, 30, 650, 50)
  851.     If $RemJump > 0 Then _A2D_DrawBitMap($jumpb, 650, 70, 0.02 * $RemJump, 20)
  852.     If $RemBoost > 0 Then _A2D_DrawBitMap($tr_ex, 650, 90, 0.05 * $RemBoost, 20)
  853.     If $running = 0 Then
  854.         _A2D_DrawString("SPIELEN", 40, 360, 200)
  855.         _A2D_DrawString("HILFE", 40, 385, 250)
  856.         _A2D_DrawString("EINSTELUNGEN", 40, 305, 300)
  857.         _A2D_DrawString("VERLASSEN", 40, 340, 350)
  858.         If $ch = 1 Then
  859.             _A2D_DrawString("--->                                              <---", 30, 230, 200)
  860.         ElseIf $ch = 2 Then
  861.             _A2D_DrawString("--->                                              <---", 30, 230, 250)
  862.         ElseIf $ch = 3 Then
  863.             _A2D_DrawString("--->                                              <---", 30, 230, 300)
  864.         ElseIf $ch = 4 Then
  865.             _A2D_DrawString("--->                                              <---", 30, 230, 350)
  866.         EndIf
  867.     EndIf
  868.     _A2D_DrawString($GameVersion, 10, 2, 718)
  869.     _A2D_FPS()
  870.     _A2D_Buffer()
  871. EndFunc   ;==>_Draw
  872. While 1
  873.     $start_t = @MSEC
  874.     If $running = 1 And $pause = 0 Then
  875.         If _IsPressed("26", $hDLL) Then _jump()
  876.         If _IsPressed("25", $hDLL) Then
  877.             If $PandaX - $panda_m > 3 Then
  878.                 $PandaX -= $panda_m ;links
  879.                 $score -= 1
  880.                 $scorecount -= 1
  881.                 $hscore -= $anti_t
  882.             EndIf
  883.         EndIf
  884.         If _IsPressed("27", $hDLL) Then
  885.             If $PandaX + $panda_m < 875 Then
  886.                 $panda_an += 1
  887.                 $PandaX += $panda_m ;rechts
  888.                 $score += 1
  889.                 $scorecount += 1
  890.                 $hscore += $anti_t
  891.             EndIf
  892.         EndIf
  893.         #cs
  894.             If _IsPressed("28", $hDLL) Then
  895.             $PandaH = 25
  896.             If $injump = 1 Then
  897.             If $down = 0 Then $PandaY += 25
  898.             $Gravity = 0.5
  899.             $down = 1
  900.             Else
  901.             $PandaY = 405
  902.             EndIf
  903.             ElseIf $PandaH <> 50 Then
  904.             $down = 0
  905.             $PandaH = 50
  906.             $PandaY = 380
  907.             EndIf
  908.         #ce
  909.         $score += 2
  910.         $hscore += $anti_t * 2
  911.         $scorecount += 2
  912.     EndIf
  913.     _Draw()
  914.     If $scorecount >= 1000 And $running = 1 Then
  915.         $bosscount += 1
  916.         $scorecount = 0
  917.         $StageSpeed += 0.1
  918.     EndIf
  919.     If $bosscount >= 10 And $RemBoost = 0 And $RemJump = 0 Then
  920.         $bosscount = 0
  921.         _Boss()
  922.     EndIf
  923.     $end_t = @MSEC
  924.     Sleep($gsp)
  925. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement