Advertisement
FireDiver

PandaRunner Beta 1.0

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