Der "Hilfe" Thread :D Alle Fragen HIER rein!

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Werbung zur Unterstützung des Forums ( Bitte AddBlocker deaktivieren )

    • Markiska;2596 schrieb:

      Also,
      Wie kann ich Eine Datei in einem anderen fenster öffnen.
      Ich meine das ungefähr so:
      ICh habe eine *.exe Datei wenn ich die starte äffnet sich ein Fenster mit diesen Datei
      die ich haben will.
      Hoffe du kannst mir helfen^^



      Ich versteh da nur Baaaaahhnhof.. bitte ebschreibt das nochmal genauer
    • Also,
      ich hab das so was mit php zusammen gescryptet und jetzt wenn ich das starte öffnet ich das im browser.
      Jetzt will ich aber sone blabla.exe habe wo sich das drine öffnet (im extra Fenster).
      Hoffe das es alle verstanden habe^^
    • Markiska;2600 schrieb:

      Also,
      ich hab das so was mit php zusammen gescryptet und jetzt wenn ich das starte öffnet ich das im browser.
      Jetzt will ich aber sone blabla.exe habe wo sich das drine öffnet (im extra Fenster).
      Hoffe das es alle verstanden habe^^


      Also nochmal..
      Du hast ein php Script, und möchtest das in ner exe ausführen, sozusagen in nem kleinen Browser?
      Könnte ich dir schnell in c# hinbasteln wenn du willst...
    • Wie kann man Tabs einbauen xD?
      Kannste vllt sowas in deinen Source hinzufügen und Releasen ?^^
      Oder du schreibst mir einfach den Source Code in Icq^^
      Wäre echt nett.

      Lg xSayHellox

      P.S :
      Ich gehe auf einen Link und da muss man sich einloggen ich gebe dir Account daten ein und nichts passiert.
      Der Browser bleibt immer noch auf der gleich Seite
    • ich scheck das jetzt nicht ganz xD
      alsou ich möchte tetris am laufen haben ( gibt ihr irgentwo n source ) bekomm ich ja auch noch
      so nun will ich die cancel und OK ding rein bekommen der Post Link vor dir verrät mir schon mal die ID von cancel und OK usw ...
      aber wenn ich das mit der id abändere von dir Drago dann klappt beides nicht
      hier mal mein code

      [SIZE="2"]

      C-Quellcode

      1. MsgBox ( 1,"Tetris"," Viel Glück bei Tetris ( 0.1 ) by Aêry ")
      2. If $Msg = 2 Then
      3. Exit
      4. Endif
      5. If $Msg = 1 Then --- und weiter ? ---
      6. #NoTrayIcon
      7. $Sound1 = Soundplay("1.mp3")
      8. Sleep(800)
      9. #include <GUIConstants.au3>
      10. AutoItSetOption("MustDeclareVars", 1)
      11. Global Const $BOARD_WIDTH = 10
      12. Global Const $BOARD_HEIGHT = 20
      13. Global Const $EMPTY_COLOUR = -1
      14. Global Const $TOWER_COLOUR = 0xff0000
      15. Global Const $BOX_COLOUR = 0x00ff00
      16. Global Const $PYRAMID_COLOUR = 0xffff00
      17. Global Const $LLEANER_COLOUR = 0xffa500
      18. Global Const $RLEANER_COLOUR = 0xff00ff
      19. Global Const $LKNIGHT_COLOUR = 0x40e0d0
      20. Global Const $RKNIGHT_COLOUR = 0xff1493
      21. Global $g_lblGameBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      22. Global $g_lblPreviewBoard[4][4]
      23. Global $g_aBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      24. Global $g_aGameShape[4][4], $g_aPreShape[4][4]
      25. Global $g_nShapeX, $g_nShapeY
      26. Global $g_nGameTick
      27. Global $g_lblScore
      28. Global $g_btnMoveLeft, $g_btnMoveRight
      29. Global $g_btnRotate, $g_btnDrop
      30. Global $g_btnStart
      31. Global $g_bGameStarted = False
      32. Global $msg
      33. GUICreate("AutoIT Tetris", 490, 560)
      34. _DrawGameBoard()
      35. _DrawPreviewBoard()
      36. $g_lblScore = GUICtrlCreateLabel("SCORE: 0", 305, 200, 165, 20)
      37. GUICtrlSetFont(-1, 10, 800)
      38. GUISetBkColor(0x000000)
      39. $g_btnMoveLeft = GUICtrlCreateButton("Links (or <-)", 280, 280, 100, 25)
      40. $g_btnMoveRight = GUICtrlCreateButton("Rechts (or ->)", 390, 280, 100, 25)
      41. $g_btnRotate = GUICtrlCreateButton("Drehen (or down)", 280, 320, 100, 25)
      42. $g_btnDrop = GUICtrlCreateButton("Drop (or Space)", 390, 320, 100, 25)
      43. $g_btnStart = GUICtrlCreateButton("START (or ENTER)", 350, 400, 100, 35)
      44. GUICtrlSetState(-1, $GUI_FOCUS)
      45. GUISetState(@SW_SHOW)
      46. While 1
      47. $msg = GuiGetMsg()
      48. Select
      49. Case $msg = $GUI_EVENT_CLOSE
      50. SoundPlay("2.wav")
      51. ExitLoop
      52. Case $msg = $g_btnStart
      53. GUICtrlSetState($g_btnStart, $GUI_DISABLE)
      54. _NewGame()
      55. Case $msg = $g_btnMoveLeft
      56. _MoveShape(-1, 0)
      57. Case $msg = $g_btnMoveRight
      58. _MoveShape(1, 0)
      59. Case $msg = $g_btnRotate
      60. _RotateShape()
      61. Case $msg = $g_btnDrop
      62. AdlibDisable()
      63. AdlibEnable("_MoveShapeDown", 25)
      64. EndSelect
      65. WEnd
      66. GUIDelete()
      67. Func _NewShape()
      68. Local $nShape, $i, $j
      69. For $i = 0 To 3
      70. For $j = 0 To 3
      71. $g_aGameShape[$i][$j] = $EMPTY_COLOUR
      72. Next
      73. Next
      74. $g_nShapeX = ($BOARD_WIDTH/2)-2
      75. $g_nShapeY = -1
      76. If Not $g_bGameStarted Then
      77. $nShape = Random(1, 7, 1)
      78. ; Block types
      79. ; 1 2 3 4 5 6 7
      80. ; X
      81. ; X XX X XX XX XX XX
      82. ; X XX XXX XX XX X X
      83. ; X X X
      84. Switch $nShape
      85. Case 1
      86. ; Tower
      87. $g_aGameShape[1][0] = $TOWER_COLOUR
      88. $g_aGameShape[1][1] = $TOWER_COLOUR
      89. $g_aGameShape[1][2] = $TOWER_COLOUR
      90. $g_aGameShape[1][3] = $TOWER_COLOUR
      91. $g_nShapeY = 0
      92. Case 2
      93. ; Box
      94. $g_aGameShape[1][1] = $BOX_COLOUR
      95. $g_aGameShape[1][2] = $BOX_COLOUR
      96. $g_aGameShape[2][1] = $BOX_COLOUR
      97. $g_aGameShape[2][2] = $BOX_COLOUR
      98. case 3
      99. ; Pyramid
      100. $g_aGameShape[1][1] = $PYRAMID_COLOUR
      101. $g_aGameShape[0][2] = $PYRAMID_COLOUR
      102. $g_aGameShape[1][2] = $PYRAMID_COLOUR
      103. $g_aGameShape[2][2] = $PYRAMID_COLOUR
      104. case 4
      105. ; Left Leaner
      106. $g_aGameShape[0][1] = $LLEANER_COLOUR
      107. $g_aGameShape[1][1] = $LLEANER_COLOUR
      108. $g_aGameShape[1][2] = $LLEANER_COLOUR
      109. $g_aGameShape[2][2] = $LLEANER_COLOUR
      110. case 5
      111. ; Right Leaner
      112. $g_aGameShape[2][1] = $RLEANER_COLOUR
      113. $g_aGameShape[1][1] = $RLEANER_COLOUR
      114. $g_aGameShape[1][2] = $RLEANER_COLOUR
      115. $g_aGameShape[0][2] = $RLEANER_COLOUR
      116. case 6
      117. ; Left Knight
      118. $g_aGameShape[1][1] = $LKNIGHT_COLOUR
      119. $g_aGameShape[2][1] = $LKNIGHT_COLOUR
      120. $g_aGameShape[2][2] = $LKNIGHT_COLOUR
      121. $g_aGameShape[2][3] = $LKNIGHT_COLOUR
      122. case 7
      123. ; Right Knight
      124. $g_aGameShape[2][1] = $RKNIGHT_COLOUR
      125. $g_aGameShape[1][1] = $RKNIGHT_COLOUR
      126. $g_aGameShape[1][2] = $RKNIGHT_COLOUR
      127. $g_aGameShape[1][3] = $RKNIGHT_COLOUR
      128. EndSwitch
      129. Else
      130. For $i = 0 To 3
      131. For $j = 0 To 3
      132. $g_aGameShape[$i][$j] = $g_aPreShape[$i][$j]
      133. Next
      134. Next
      135. If $g_aGameShape[1][0] = $TOWER_COLOUR Then $g_nShapeY = 0
      136. EndIf
      137. For $i = 0 To 3
      138. For $j = 0 To 3
      139. $g_aPreShape[$i][$j] = $EMPTY_COLOUR
      140. Next
      141. Next
      142. $nShape = Random(1, 7, 1)
      143. Switch $nShape
      144. Case 1
      145. $g_aPreShape[1][0] = $TOWER_COLOUR
      146. $g_aPreShape[1][1] = $TOWER_COLOUR
      147. $g_aPreShape[1][2] = $TOWER_COLOUR
      148. $g_aPreShape[1][3] = $TOWER_COLOUR
      149. Case 2
      150. $g_aPreShape[1][1] = $BOX_COLOUR
      151. $g_aPreShape[1][2] = $BOX_COLOUR
      152. $g_aPreShape[2][1] = $BOX_COLOUR
      153. $g_aPreShape[2][2] = $BOX_COLOUR
      154. case 3
      155. $g_aPreShape[1][1] = $PYRAMID_COLOUR
      156. $g_aPreShape[0][2] = $PYRAMID_COLOUR
      157. $g_aPreShape[1][2] = $PYRAMID_COLOUR
      158. $g_aPreShape[2][2] = $PYRAMID_COLOUR
      159. case 4
      160. $g_aPreShape[0][1] = $LLEANER_COLOUR
      161. $g_aPreShape[1][1] = $LLEANER_COLOUR
      162. $g_aPreShape[1][2] = $LLEANER_COLOUR
      163. $g_aPreShape[2][2] = $LLEANER_COLOUR
      164. case 5
      165. $g_aPreShape[2][1] = $RLEANER_COLOUR
      166. $g_aPreShape[1][1] = $RLEANER_COLOUR
      167. $g_aPreShape[1][2] = $RLEANER_COLOUR
      168. $g_aPreShape[0][2] = $RLEANER_COLOUR
      169. case 6
      170. $g_aPreShape[1][1] = $LKNIGHT_COLOUR
      171. $g_aPreShape[2][1] = $LKNIGHT_COLOUR
      172. $g_aPreShape[2][2] = $LKNIGHT_COLOUR
      173. $g_aPreShape[2][3] = $LKNIGHT_COLOUR
      174. case 7
      175. $g_aPreShape[2][1] = $RKNIGHT_COLOUR
      176. $g_aPreShape[1][1] = $RKNIGHT_COLOUR
      177. $g_aPreShape[1][2] = $RKNIGHT_COLOUR
      178. $g_aPreShape[1][3] = $RKNIGHT_COLOUR
      179. EndSwitch
      180. For $i = 0 To 3
      181. For $j = 0 To 3
      182. If $g_aPreShape[$i][$j] = $EMPTY_COLOUR Then
      183. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      184. Else
      185. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $g_aPreShape[$i][$j])
      186. EndIf
      187. Next
      188. Next
      189. EndFunc
      190. Func _MoveShapeLeft()
      191. _MoveShape(-1, 0)
      192. EndFunc
      193. Func _MoveShapeRight()
      194. _MoveShape(1, 0)
      195. EndFunc
      196. Func _MoveShapeDown()
      197. _MoveShape(0, 1)
      198. EndFunc
      199. Func _DropShape()
      200. AdlibDisable()
      201. AdlibEnable("_MoveShapeDown", 25)
      202. EndFunc
      203. Func _MoveShape($nMoveX, $nMoveY)
      204. Local $nCollision, $i, $j
      205. Local $bFilled, $x, $y
      206. Local $sScoreText, $nScore
      207. If _CollisionTest($nMoveX, $nMoveY) Then
      208. If $nMoveY = 1 Then
      209. If $g_nShapeY < 1 Then
      210. AdlibDisable()
      211. MsgBox(0, "AutoIT Tetris", "GAME OVER!")
      212. GUICtrlSetState($g_btnStart, $GUI_ENABLE)
      213. HotKeySet("{LEFT}")
      214. HotKeySet("{RIGHT}")
      215. HotKeySet("{DOWN}")
      216. HotKeySet("{SPACE}")
      217. Return
      218. Else
      219. For $i = 0 To 3
      220. For $j = 0 To 3
      221. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      222. $g_aBoard[$g_nShapeX+$i][$g_nShapeY+$j] = $g_aGameShape[$i][$j]
      223. EndIf
      224. Next
      225. Next
      226. For $j = 0 To ($BOARD_HEIGHT-1)
      227. $bFilled = True
      228. For $i = 0 To ($BOARD_WIDTH-1)
      229. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      230. $bFilled = False
      231. ExitLoop
      232. EndIf
      233. Next
      234. If $bFilled Then
      235. $sScoreText = GUICtrlRead($g_lblScore)
      236. $nScore = Number(StringRight($sScoreText, StringLen($sScoreText)-7))+10
      237. If Mod($nScore, 50) = 0 Then
      238. $g_nGameTick -= 10
      239. EndIf
      240. GUICtrlSetData($g_lblScore, "SCORE: " & $nScore)
      241. For $x = 0 To ($BOARD_WIDTH-1)
      242. For $y = $j To 1 Step -1
      243. $g_aBoard[$x][$y] = $g_aBoard[$x][$y-1]
      244. Next
      245. Next
      246. _RedrawGameBoard()
      247. EndIf
      248. Next
      249. AdlibDisable()
      250. _NewShape()
      251. _DrawGameShape()
      252. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      253. EndIf
      254. EndIf
      255. Else
      256. _DrawGameShape(True)
      257. If $nMoveX <> 0 Then $g_nShapeX += $nMoveX
      258. If $nMoveY <> 0 Then $g_nShapeY += $nMoveY
      259. _DrawGameShape()
      260. EndIf
      261. EndFunc
      262. Func _RotateShape()
      263. Local $i, $j, $aTempShape[4][4]
      264. For $i = 0 To 3
      265. For $j = 0 To 3
      266. $aTempShape[3-$j][$i] = $g_aGameShape[$i][$j]
      267. Next
      268. Next
      269. For $i = 0 To 3
      270. For $j = 0 To 3
      271. If $aTempShape[$i][$j] <> $EMPTY_COLOUR Then
      272. If ($g_nShapeX+$i) < 0 Or ($g_nShapeX+$i) > ($BOARD_WIDTH- 1) Or _
      273. ($g_nShapeY+$j) < 0 Or ($g_nShapeY+$j) > ($BOARD_HEIGHT-1) Then
      274. Return
      275. EndIf
      276. EndIf
      277. Next
      278. Next
      279. For $x = 0 To ($BOARD_WIDTH-1)
      280. For $y = 0 To ($BOARD_HEIGHT-1)
      281. If $x >= $g_nShapeX And $x < ($g_nShapeX+4) Then
      282. If $y >= $g_nShapeY And $y < ($g_nShapeY+4) Then
      283. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      284. If $aTempShape[$x-$g_nShapeX][$y-$g_nShapeY] <> $EMPTY_COLOUR Then
      285. Return
      286. EndIf
      287. EndIf
      288. EndIf
      289. EndIf
      290. Next
      291. Next
      292. _DrawGameShape(True)
      293. For $i = 0 To 3
      294. For $j = 0 To 3
      295. $g_aGameShape[$i][$j] = $aTempShape[$i][$j]
      296. Next
      297. Next
      298. _DrawGameShape()
      299. EndFunc
      300. Func _CollisionTest($nMoveX, $nMoveY)
      301. Local $nNewX = $g_nShapeX+$nMoveX
      302. Local $nNewY = $g_nShapeY+$nMoveY
      303. Local $i, $j, $x, $y
      304. For $i = 0 To 3
      305. For $j = 0 To 3
      306. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      307. If ($nNewX+$i) < 0 Or ($nNewX+$i) > ($BOARD_WIDTH-1) Or _
      308. ($nNewY+$j) < 0 Or ($nNewY+$j) > ($BOARD_HEIGHT-1) Then
      309. Return True
      310. EndIf
      311. EndIf
      312. Next
      313. Next
      314. For $x = 0 To ($BOARD_WIDTH-1)
      315. For $y = 0 To ($BOARD_HEIGHT-1)
      316. If $x >= $nNewX And $x < ($nNewX+4) Then
      317. If $y >= $nNewY And $y < ($nNewY+4) Then
      318. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      319. If $g_aGameShape[$x-$nNewX][$y-$nNewY] <> $EMPTY_COLOUR Then
      320. Return True
      321. EndIf
      322. EndIf
      323. EndIf
      324. EndIf
      325. Next
      326. Next
      327. Return False
      328. EndFunc
      329. Func _DrawGameShape($bRemove = False)
      330. Local $i, $j
      331. For $i = 0 To 3
      332. For $j = 0 To 3
      333. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      334. If $bRemove Then
      335. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $GUI_BKCOLOR_TRANSPARENT)
      336. Else
      337. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $g_aGameShape[$i][$j])
      338. EndIf
      339. EndIf
      340. Next
      341. Next
      342. EndFunc
      343. Func _DrawGameBoard()
      344. Local $i, $j
      345. Local $x, $y
      346. $x = 20
      347. $y = 20
      348. For $i = 0 To $BOARD_WIDTH-1
      349. For $j = 0 To $BOARD_HEIGHT-1
      350. GUICtrlCreateLabel("", $x, $y, 25, 25)
      351. $g_lblGameBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      352. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      353. $y = $y+26
      354. Next
      355. $x = $x+26
      356. $y = 20
      357. Next
      358. EndFunc
      359. Func _DrawPreviewBoard()
      360. Local $i, $j
      361. Local $x, $y
      362. $x = 340
      363. $y = 40
      364. GUICtrlCreateLabel("Next Shape:", $x, 20, 104, 18)
      365. For $i = 0 To 3
      366. For $j = 0 To 3
      367. GUICtrlCreateLabel("", $x, $y, 25, 25)
      368. $g_lblPreviewBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      369. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      370. $y = $y+26
      371. Next
      372. $x = $x+26
      373. $y = 40
      374. Next
      375. EndFunc
      376. Func _RedrawGameBoard()
      377. Local $i, $j
      378. For $i = 0 To $BOARD_WIDTH-1
      379. For $j = 0 To $BOARD_HEIGHT-1
      380. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      381. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      382. Else
      383. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $g_aBoard[$i][$j])
      384. EndIf
      385. Next
      386. Next
      387. EndFunc
      388. Func _NewGame()
      389. Local $i, $j
      390. AdlibDisable()
      391. HotKeySet("{LEFT}", "_MoveShapeLeft")
      392. HotKeySet("{RIGHT}", "_MoveShapeRight")
      393. HotKeySet("{DOWN}", "_RotateShape")
      394. HotKeySet("{SPACE}", "_DropShape")
      395. $g_bGameStarted = False
      396. For $i = 0 To $BOARD_WIDTH-1
      397. For $j = 0 To $BOARD_HEIGHT-1
      398. $g_aBoard[$i][$j] = $EMPTY_COLOUR
      399. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      400. Next
      401. Next
      402. _NewShape()
      403. $g_bGameStarted = True
      404. _DrawGameShape()
      405. $g_nGameTick = 500
      406. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      407. EndFunc
      Alles anzeigen
      [/SIZE]

      Hoffe mir antwortet jemand schnell :P
      mfg Aêry
    • ganz einfach, du amchst den Tetris Code in die 2. If schleife rein ;)

      C-Quellcode

      1. MsgBox ( 1,"Tetris"," Viel Glück bei Tetris ( 0.1 ) by Aêry ")
      2. If $Msg = 2 Then
      3. Exit
      4. Endif
      5. If $Msg = 1 Then
      6. #NoTrayIcon
      7. $Sound1 = Soundplay("1.mp3")
      8. Sleep(800)
      9. #include <GUIConstants.au3>
      10. AutoItSetOption("MustDeclareVars", 1)
      11. Global Const $BOARD_WIDTH = 10
      12. Global Const $BOARD_HEIGHT = 20
      13. Global Const $EMPTY_COLOUR = -1
      14. Global Const $TOWER_COLOUR = 0xff0000
      15. Global Const $BOX_COLOUR = 0x00ff00
      16. Global Const $PYRAMID_COLOUR = 0xffff00
      17. Global Const $LLEANER_COLOUR = 0xffa500
      18. Global Const $RLEANER_COLOUR = 0xff00ff
      19. Global Const $LKNIGHT_COLOUR = 0x40e0d0
      20. Global Const $RKNIGHT_COLOUR = 0xff1493
      21. Global $g_lblGameBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      22. Global $g_lblPreviewBoard[4][4]
      23. Global $g_aBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      24. Global $g_aGameShape[4][4], $g_aPreShape[4][4]
      25. Global $g_nShapeX, $g_nShapeY
      26. Global $g_nGameTick
      27. Global $g_lblScore
      28. Global $g_btnMoveLeft, $g_btnMoveRight
      29. Global $g_btnRotate, $g_btnDrop
      30. Global $g_btnStart
      31. Global $g_bGameStarted = False
      32. Global $msg
      33. GUICreate("AutoIT Tetris", 490, 560)
      34. _DrawGameBoard()
      35. _DrawPreviewBoard()
      36. $g_lblScore = GUICtrlCreateLabel("SCORE: 0", 305, 200, 165, 20)
      37. GUICtrlSetFont(-1, 10, 800)
      38. GUISetBkColor(0x000000)
      39. $g_btnMoveLeft = GUICtrlCreateButton("Links (or <-)", 280, 280, 100, 25)
      40. $g_btnMoveRight = GUICtrlCreateButton("Rechts (or ->)", 390, 280, 100, 25)
      41. $g_btnRotate = GUICtrlCreateButton("Drehen (or down)", 280, 320, 100, 25)
      42. $g_btnDrop = GUICtrlCreateButton("Drop (or Space)", 390, 320, 100, 25)
      43. $g_btnStart = GUICtrlCreateButton("START (or ENTER)", 350, 400, 100, 35)
      44. GUICtrlSetState(-1, $GUI_FOCUS)
      45. GUISetState(@SW_SHOW)
      46. While 1
      47. $msg = GuiGetMsg()
      48. Select
      49. Case $msg = $GUI_EVENT_CLOSE
      50. SoundPlay("2.wav")
      51. ExitLoop
      52. Case $msg = $g_btnStart
      53. GUICtrlSetState($g_btnStart, $GUI_DISABLE)
      54. _NewGame()
      55. Case $msg = $g_btnMoveLeft
      56. _MoveShape(-1, 0)
      57. Case $msg = $g_btnMoveRight
      58. _MoveShape(1, 0)
      59. Case $msg = $g_btnRotate
      60. _RotateShape()
      61. Case $msg = $g_btnDrop
      62. AdlibDisable()
      63. AdlibEnable("_MoveShapeDown", 25)
      64. EndSelect
      65. WEnd
      66. GUIDelete()
      67. Func _NewShape()
      68. Local $nShape, $i, $j
      69. For $i = 0 To 3
      70. For $j = 0 To 3
      71. $g_aGameShape[$i][$j] = $EMPTY_COLOUR
      72. Next
      73. Next
      74. $g_nShapeX = ($BOARD_WIDTH/2)-2
      75. $g_nShapeY = -1
      76. If Not $g_bGameStarted Then
      77. $nShape = Random(1, 7, 1)
      78. ; Block types
      79. ; 1 2 3 4 5 6 7
      80. ; X
      81. ; X XX X XX XX XX XX
      82. ; X XX XXX XX XX X X
      83. ; X X X
      84. Switch $nShape
      85. Case 1
      86. ; Tower
      87. $g_aGameShape[1][0] = $TOWER_COLOUR
      88. $g_aGameShape[1][1] = $TOWER_COLOUR
      89. $g_aGameShape[1][2] = $TOWER_COLOUR
      90. $g_aGameShape[1][3] = $TOWER_COLOUR
      91. $g_nShapeY = 0
      92. Case 2
      93. ; Box
      94. $g_aGameShape[1][1] = $BOX_COLOUR
      95. $g_aGameShape[1][2] = $BOX_COLOUR
      96. $g_aGameShape[2][1] = $BOX_COLOUR
      97. $g_aGameShape[2][2] = $BOX_COLOUR
      98. case 3
      99. ; Pyramid
      100. $g_aGameShape[1][1] = $PYRAMID_COLOUR
      101. $g_aGameShape[0][2] = $PYRAMID_COLOUR
      102. $g_aGameShape[1][2] = $PYRAMID_COLOUR
      103. $g_aGameShape[2][2] = $PYRAMID_COLOUR
      104. case 4
      105. ; Left Leaner
      106. $g_aGameShape[0][1] = $LLEANER_COLOUR
      107. $g_aGameShape[1][1] = $LLEANER_COLOUR
      108. $g_aGameShape[1][2] = $LLEANER_COLOUR
      109. $g_aGameShape[2][2] = $LLEANER_COLOUR
      110. case 5
      111. ; Right Leaner
      112. $g_aGameShape[2][1] = $RLEANER_COLOUR
      113. $g_aGameShape[1][1] = $RLEANER_COLOUR
      114. $g_aGameShape[1][2] = $RLEANER_COLOUR
      115. $g_aGameShape[0][2] = $RLEANER_COLOUR
      116. case 6
      117. ; Left Knight
      118. $g_aGameShape[1][1] = $LKNIGHT_COLOUR
      119. $g_aGameShape[2][1] = $LKNIGHT_COLOUR
      120. $g_aGameShape[2][2] = $LKNIGHT_COLOUR
      121. $g_aGameShape[2][3] = $LKNIGHT_COLOUR
      122. case 7
      123. ; Right Knight
      124. $g_aGameShape[2][1] = $RKNIGHT_COLOUR
      125. $g_aGameShape[1][1] = $RKNIGHT_COLOUR
      126. $g_aGameShape[1][2] = $RKNIGHT_COLOUR
      127. $g_aGameShape[1][3] = $RKNIGHT_COLOUR
      128. EndSwitch
      129. Else
      130. For $i = 0 To 3
      131. For $j = 0 To 3
      132. $g_aGameShape[$i][$j] = $g_aPreShape[$i][$j]
      133. Next
      134. Next
      135. If $g_aGameShape[1][0] = $TOWER_COLOUR Then $g_nShapeY = 0
      136. EndIf
      137. For $i = 0 To 3
      138. For $j = 0 To 3
      139. $g_aPreShape[$i][$j] = $EMPTY_COLOUR
      140. Next
      141. Next
      142. $nShape = Random(1, 7, 1)
      143. Switch $nShape
      144. Case 1
      145. $g_aPreShape[1][0] = $TOWER_COLOUR
      146. $g_aPreShape[1][1] = $TOWER_COLOUR
      147. $g_aPreShape[1][2] = $TOWER_COLOUR
      148. $g_aPreShape[1][3] = $TOWER_COLOUR
      149. Case 2
      150. $g_aPreShape[1][1] = $BOX_COLOUR
      151. $g_aPreShape[1][2] = $BOX_COLOUR
      152. $g_aPreShape[2][1] = $BOX_COLOUR
      153. $g_aPreShape[2][2] = $BOX_COLOUR
      154. case 3
      155. $g_aPreShape[1][1] = $PYRAMID_COLOUR
      156. $g_aPreShape[0][2] = $PYRAMID_COLOUR
      157. $g_aPreShape[1][2] = $PYRAMID_COLOUR
      158. $g_aPreShape[2][2] = $PYRAMID_COLOUR
      159. case 4
      160. $g_aPreShape[0][1] = $LLEANER_COLOUR
      161. $g_aPreShape[1][1] = $LLEANER_COLOUR
      162. $g_aPreShape[1][2] = $LLEANER_COLOUR
      163. $g_aPreShape[2][2] = $LLEANER_COLOUR
      164. case 5
      165. $g_aPreShape[2][1] = $RLEANER_COLOUR
      166. $g_aPreShape[1][1] = $RLEANER_COLOUR
      167. $g_aPreShape[1][2] = $RLEANER_COLOUR
      168. $g_aPreShape[0][2] = $RLEANER_COLOUR
      169. case 6
      170. $g_aPreShape[1][1] = $LKNIGHT_COLOUR
      171. $g_aPreShape[2][1] = $LKNIGHT_COLOUR
      172. $g_aPreShape[2][2] = $LKNIGHT_COLOUR
      173. $g_aPreShape[2][3] = $LKNIGHT_COLOUR
      174. case 7
      175. $g_aPreShape[2][1] = $RKNIGHT_COLOUR
      176. $g_aPreShape[1][1] = $RKNIGHT_COLOUR
      177. $g_aPreShape[1][2] = $RKNIGHT_COLOUR
      178. $g_aPreShape[1][3] = $RKNIGHT_COLOUR
      179. EndSwitch
      180. For $i = 0 To 3
      181. For $j = 0 To 3
      182. If $g_aPreShape[$i][$j] = $EMPTY_COLOUR Then
      183. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      184. Else
      185. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $g_aPreShape[$i][$j])
      186. EndIf
      187. Next
      188. Next
      189. EndFunc
      190. Func _MoveShapeLeft()
      191. _MoveShape(-1, 0)
      192. EndFunc
      193. Func _MoveShapeRight()
      194. _MoveShape(1, 0)
      195. EndFunc
      196. Func _MoveShapeDown()
      197. _MoveShape(0, 1)
      198. EndFunc
      199. Func _DropShape()
      200. AdlibDisable()
      201. AdlibEnable("_MoveShapeDown", 25)
      202. EndFunc
      203. Func _MoveShape($nMoveX, $nMoveY)
      204. Local $nCollision, $i, $j
      205. Local $bFilled, $x, $y
      206. Local $sScoreText, $nScore
      207. If _CollisionTest($nMoveX, $nMoveY) Then
      208. If $nMoveY = 1 Then
      209. If $g_nShapeY < 1 Then
      210. AdlibDisable()
      211. MsgBox(0, "AutoIT Tetris", "GAME OVER!")
      212. GUICtrlSetState($g_btnStart, $GUI_ENABLE)
      213. HotKeySet("{LEFT}")
      214. HotKeySet("{RIGHT}")
      215. HotKeySet("{DOWN}")
      216. HotKeySet("{SPACE}")
      217. Return
      218. Else
      219. For $i = 0 To 3
      220. For $j = 0 To 3
      221. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      222. $g_aBoard[$g_nShapeX+$i][$g_nShapeY+$j] = $g_aGameShape[$i][$j]
      223. EndIf
      224. Next
      225. Next
      226. For $j = 0 To ($BOARD_HEIGHT-1)
      227. $bFilled = True
      228. For $i = 0 To ($BOARD_WIDTH-1)
      229. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      230. $bFilled = False
      231. ExitLoop
      232. EndIf
      233. Next
      234. If $bFilled Then
      235. $sScoreText = GUICtrlRead($g_lblScore)
      236. $nScore = Number(StringRight($sScoreText, StringLen($sScoreText)-7))+10
      237. If Mod($nScore, 50) = 0 Then
      238. $g_nGameTick -= 10
      239. EndIf
      240. GUICtrlSetData($g_lblScore, "SCORE: " & $nScore)
      241. For $x = 0 To ($BOARD_WIDTH-1)
      242. For $y = $j To 1 Step -1
      243. $g_aBoard[$x][$y] = $g_aBoard[$x][$y-1]
      244. Next
      245. Next
      246. _RedrawGameBoard()
      247. EndIf
      248. Next
      249. AdlibDisable()
      250. _NewShape()
      251. _DrawGameShape()
      252. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      253. EndIf
      254. EndIf
      255. Else
      256. _DrawGameShape(True)
      257. If $nMoveX <> 0 Then $g_nShapeX += $nMoveX
      258. If $nMoveY <> 0 Then $g_nShapeY += $nMoveY
      259. _DrawGameShape()
      260. EndIf
      261. EndFunc
      262. Func _RotateShape()
      263. Local $i, $j, $aTempShape[4][4]
      264. For $i = 0 To 3
      265. For $j = 0 To 3
      266. $aTempShape[3-$j][$i] = $g_aGameShape[$i][$j]
      267. Next
      268. Next
      269. For $i = 0 To 3
      270. For $j = 0 To 3
      271. If $aTempShape[$i][$j] <> $EMPTY_COLOUR Then
      272. If ($g_nShapeX+$i) < 0 Or ($g_nShapeX+$i) > ($BOARD_WIDTH- 1) Or _
      273. ($g_nShapeY+$j) < 0 Or ($g_nShapeY+$j) > ($BOARD_HEIGHT-1) Then
      274. Return
      275. EndIf
      276. EndIf
      277. Next
      278. Next
      279. For $x = 0 To ($BOARD_WIDTH-1)
      280. For $y = 0 To ($BOARD_HEIGHT-1)
      281. If $x >= $g_nShapeX And $x < ($g_nShapeX+4) Then
      282. If $y >= $g_nShapeY And $y < ($g_nShapeY+4) Then
      283. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      284. If $aTempShape[$x-$g_nShapeX][$y-$g_nShapeY] <> $EMPTY_COLOUR Then
      285. Return
      286. EndIf
      287. EndIf
      288. EndIf
      289. EndIf
      290. Next
      291. Next
      292. _DrawGameShape(True)
      293. For $i = 0 To 3
      294. For $j = 0 To 3
      295. $g_aGameShape[$i][$j] = $aTempShape[$i][$j]
      296. Next
      297. Next
      298. _DrawGameShape()
      299. EndFunc
      300. Func _CollisionTest($nMoveX, $nMoveY)
      301. Local $nNewX = $g_nShapeX+$nMoveX
      302. Local $nNewY = $g_nShapeY+$nMoveY
      303. Local $i, $j, $x, $y
      304. For $i = 0 To 3
      305. For $j = 0 To 3
      306. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      307. If ($nNewX+$i) < 0 Or ($nNewX+$i) > ($BOARD_WIDTH-1) Or _
      308. ($nNewY+$j) < 0 Or ($nNewY+$j) > ($BOARD_HEIGHT-1) Then
      309. Return True
      310. EndIf
      311. EndIf
      312. Next
      313. Next
      314. For $x = 0 To ($BOARD_WIDTH-1)
      315. For $y = 0 To ($BOARD_HEIGHT-1)
      316. If $x >= $nNewX And $x < ($nNewX+4) Then
      317. If $y >= $nNewY And $y < ($nNewY+4) Then
      318. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      319. If $g_aGameShape[$x-$nNewX][$y-$nNewY] <> $EMPTY_COLOUR Then
      320. Return True
      321. EndIf
      322. EndIf
      323. EndIf
      324. EndIf
      325. Next
      326. Next
      327. Return False
      328. EndFunc
      329. Func _DrawGameShape($bRemove = False)
      330. Local $i, $j
      331. For $i = 0 To 3
      332. For $j = 0 To 3
      333. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      334. If $bRemove Then
      335. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $GUI_BKCOLOR_TRANSPARENT)
      336. Else
      337. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $g_aGameShape[$i][$j])
      338. EndIf
      339. EndIf
      340. Next
      341. Next
      342. EndFunc
      343. Func _DrawGameBoard()
      344. Local $i, $j
      345. Local $x, $y
      346. $x = 20
      347. $y = 20
      348. For $i = 0 To $BOARD_WIDTH-1
      349. For $j = 0 To $BOARD_HEIGHT-1
      350. GUICtrlCreateLabel("", $x, $y, 25, 25)
      351. $g_lblGameBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      352. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      353. $y = $y+26
      354. Next
      355. $x = $x+26
      356. $y = 20
      357. Next
      358. EndFunc
      359. Func _DrawPreviewBoard()
      360. Local $i, $j
      361. Local $x, $y
      362. $x = 340
      363. $y = 40
      364. GUICtrlCreateLabel("Next Shape:", $x, 20, 104, 18)
      365. For $i = 0 To 3
      366. For $j = 0 To 3
      367. GUICtrlCreateLabel("", $x, $y, 25, 25)
      368. $g_lblPreviewBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      369. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      370. $y = $y+26
      371. Next
      372. $x = $x+26
      373. $y = 40
      374. Next
      375. EndFunc
      376. Func _RedrawGameBoard()
      377. Local $i, $j
      378. For $i = 0 To $BOARD_WIDTH-1
      379. For $j = 0 To $BOARD_HEIGHT-1
      380. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      381. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      382. Else
      383. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $g_aBoard[$i][$j])
      384. EndIf
      385. Next
      386. Next
      387. EndFunc
      388. Func _NewGame()
      389. Local $i, $j
      390. AdlibDisable()
      391. HotKeySet("{LEFT}", "_MoveShapeLeft")
      392. HotKeySet("{RIGHT}", "_MoveShapeRight")
      393. HotKeySet("{DOWN}", "_RotateShape")
      394. HotKeySet("{SPACE}", "_DropShape")
      395. $g_bGameStarted = False
      396. For $i = 0 To $BOARD_WIDTH-1
      397. For $j = 0 To $BOARD_HEIGHT-1
      398. $g_aBoard[$i][$j] = $EMPTY_COLOUR
      399. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      400. Next
      401. Next
      402. _NewShape()
      403. $g_bGameStarted = True
      404. _DrawGameShape()
      405. $g_nGameTick = 500
      406. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      407. EndFunc
      408. EndIf
      Alles anzeigen
    • Hier meine errors :

      C:\Dokumente und Einstellungen\name\Desktop\Beast World Editor Installer v2.au3(3,9) : WARNING: $Msg: possibly used before declaration.
      If $Msg =
      ~~~~~~~~^
      C:\Dokumente und Einstellungen\name\Desktop\Beast World Editor Installer v2.au3(86,1) : ERROR: missing EndIf.
      Func
      ^
      C:\Dokumente und Einstellungen\name\Desktop\Beast World Editor Installer v2.au3(7,17) : REF: missing EndIf.
      If $Msg = 1 Then
      ~~~~~~~~~~~~~~~~^
      C:\Dokumente und Einstellungen\name\Desktop\Beast World Editor Installer v2.au3(471,1) : ERROR: syntax error
      EndIf
      ^
      C:\Dokumente und Einstellungen\name\Desktop\Beast World Editor Installer v2.au3 - 2 error(s), 1 warning(s)


      Edit // hatte das projekt noch unter nem anderem namen laufen natürlich alles gedeledet
      Edit² // hab noch ebend mein name rausgeholt xD
    • Du hast ja auch die Msg nicht in die variable getan Du musst $Msg deklinieren:

      C-Quellcode

      1. [B][I][I][COLOR="Red"]$Msg[/COLOR][/I][/I][/B] = MsgBox ( 1,"Tetris"," Viel Glück bei Tetris ( 0.1 ) by Aêry ")
      2. If [COLOR="Red"][I][B]$Msg[/B][/I][/COLOR] = 2 Then
      3. Exit
      4. Endif
      5. If [B][I][COLOR="Red"]$Msg[/COLOR][/I][/B] = 1 Then
      6. #NoTrayIcon
      7. $Sound1 = Soundplay("1.mp3")
      8. Sleep(800)
      9. #include <GUIConstants.au3>
      10. AutoItSetOption("MustDeclareVars", 1)
      11. Global Const $BOARD_WIDTH = 10
      12. Global Const $BOARD_HEIGHT = 20
      13. Global Const $EMPTY_COLOUR = -1
      14. Global Const $TOWER_COLOUR = 0xff0000
      15. Global Const $BOX_COLOUR = 0x00ff00
      16. Global Const $PYRAMID_COLOUR = 0xffff00
      17. Global Const $LLEANER_COLOUR = 0xffa500
      18. Global Const $RLEANER_COLOUR = 0xff00ff
      19. Global Const $LKNIGHT_COLOUR = 0x40e0d0
      20. Global Const $RKNIGHT_COLOUR = 0xff1493
      21. Global $g_lblGameBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      22. Global $g_lblPreviewBoard[4][4]
      23. Global $g_aBoard[$BOARD_WIDTH][$BOARD_HEIGHT]
      24. Global $g_aGameShape[4][4], $g_aPreShape[4][4]
      25. Global $g_nShapeX, $g_nShapeY
      26. Global $g_nGameTick
      27. Global $g_lblScore
      28. Global $g_btnMoveLeft, $g_btnMoveRight
      29. Global $g_btnRotate, $g_btnDrop
      30. Global $g_btnStart
      31. Global $g_bGameStarted = False
      32. Global $msg
      33. GUICreate("AutoIT Tetris", 490, 560)
      34. _DrawGameBoard()
      35. _DrawPreviewBoard()
      36. $g_lblScore = GUICtrlCreateLabel("SCORE: 0", 305, 200, 165, 20)
      37. GUICtrlSetFont(-1, 10, 800)
      38. GUISetBkColor(0x000000)
      39. $g_btnMoveLeft = GUICtrlCreateButton("Links (or <-)", 280, 280, 100, 25)
      40. $g_btnMoveRight = GUICtrlCreateButton("Rechts (or ->)", 390, 280, 100, 25)
      41. $g_btnRotate = GUICtrlCreateButton("Drehen (or down)", 280, 320, 100, 25)
      42. $g_btnDrop = GUICtrlCreateButton("Drop (or Space)", 390, 320, 100, 25)
      43. $g_btnStart = GUICtrlCreateButton("START (or ENTER)", 350, 400, 100, 35)
      44. GUICtrlSetState(-1, $GUI_FOCUS)
      45. GUISetState(@SW_SHOW)
      46. While 1
      47. $msg = GuiGetMsg()
      48. Select
      49. Case $msg = $GUI_EVENT_CLOSE
      50. SoundPlay("2.wav")
      51. ExitLoop
      52. Case $msg = $g_btnStart
      53. GUICtrlSetState($g_btnStart, $GUI_DISABLE)
      54. _NewGame()
      55. Case $msg = $g_btnMoveLeft
      56. _MoveShape(-1, 0)
      57. Case $msg = $g_btnMoveRight
      58. _MoveShape(1, 0)
      59. Case $msg = $g_btnRotate
      60. _RotateShape()
      61. Case $msg = $g_btnDrop
      62. AdlibDisable()
      63. AdlibEnable("_MoveShapeDown", 25)
      64. EndSelect
      65. WEnd
      66. GUIDelete()
      67. Func _NewShape()
      68. Local $nShape, $i, $j
      69. For $i = 0 To 3
      70. For $j = 0 To 3
      71. $g_aGameShape[$i][$j] = $EMPTY_COLOUR
      72. Next
      73. Next
      74. $g_nShapeX = ($BOARD_WIDTH/2)-2
      75. $g_nShapeY = -1
      76. If Not $g_bGameStarted Then
      77. $nShape = Random(1, 7, 1)
      78. ; Block types
      79. ; 1 2 3 4 5 6 7
      80. ; X
      81. ; X XX X XX XX XX XX
      82. ; X XX XXX XX XX X X
      83. ; X X X
      84. Switch $nShape
      85. Case 1
      86. ; Tower
      87. $g_aGameShape[1][0] = $TOWER_COLOUR
      88. $g_aGameShape[1][1] = $TOWER_COLOUR
      89. $g_aGameShape[1][2] = $TOWER_COLOUR
      90. $g_aGameShape[1][3] = $TOWER_COLOUR
      91. $g_nShapeY = 0
      92. Case 2
      93. ; Box
      94. $g_aGameShape[1][1] = $BOX_COLOUR
      95. $g_aGameShape[1][2] = $BOX_COLOUR
      96. $g_aGameShape[2][1] = $BOX_COLOUR
      97. $g_aGameShape[2][2] = $BOX_COLOUR
      98. case 3
      99. ; Pyramid
      100. $g_aGameShape[1][1] = $PYRAMID_COLOUR
      101. $g_aGameShape[0][2] = $PYRAMID_COLOUR
      102. $g_aGameShape[1][2] = $PYRAMID_COLOUR
      103. $g_aGameShape[2][2] = $PYRAMID_COLOUR
      104. case 4
      105. ; Left Leaner
      106. $g_aGameShape[0][1] = $LLEANER_COLOUR
      107. $g_aGameShape[1][1] = $LLEANER_COLOUR
      108. $g_aGameShape[1][2] = $LLEANER_COLOUR
      109. $g_aGameShape[2][2] = $LLEANER_COLOUR
      110. case 5
      111. ; Right Leaner
      112. $g_aGameShape[2][1] = $RLEANER_COLOUR
      113. $g_aGameShape[1][1] = $RLEANER_COLOUR
      114. $g_aGameShape[1][2] = $RLEANER_COLOUR
      115. $g_aGameShape[0][2] = $RLEANER_COLOUR
      116. case 6
      117. ; Left Knight
      118. $g_aGameShape[1][1] = $LKNIGHT_COLOUR
      119. $g_aGameShape[2][1] = $LKNIGHT_COLOUR
      120. $g_aGameShape[2][2] = $LKNIGHT_COLOUR
      121. $g_aGameShape[2][3] = $LKNIGHT_COLOUR
      122. case 7
      123. ; Right Knight
      124. $g_aGameShape[2][1] = $RKNIGHT_COLOUR
      125. $g_aGameShape[1][1] = $RKNIGHT_COLOUR
      126. $g_aGameShape[1][2] = $RKNIGHT_COLOUR
      127. $g_aGameShape[1][3] = $RKNIGHT_COLOUR
      128. EndSwitch
      129. Else
      130. For $i = 0 To 3
      131. For $j = 0 To 3
      132. $g_aGameShape[$i][$j] = $g_aPreShape[$i][$j]
      133. Next
      134. Next
      135. If $g_aGameShape[1][0] = $TOWER_COLOUR Then $g_nShapeY = 0
      136. EndIf
      137. For $i = 0 To 3
      138. For $j = 0 To 3
      139. $g_aPreShape[$i][$j] = $EMPTY_COLOUR
      140. Next
      141. Next
      142. $nShape = Random(1, 7, 1)
      143. Switch $nShape
      144. Case 1
      145. $g_aPreShape[1][0] = $TOWER_COLOUR
      146. $g_aPreShape[1][1] = $TOWER_COLOUR
      147. $g_aPreShape[1][2] = $TOWER_COLOUR
      148. $g_aPreShape[1][3] = $TOWER_COLOUR
      149. Case 2
      150. $g_aPreShape[1][1] = $BOX_COLOUR
      151. $g_aPreShape[1][2] = $BOX_COLOUR
      152. $g_aPreShape[2][1] = $BOX_COLOUR
      153. $g_aPreShape[2][2] = $BOX_COLOUR
      154. case 3
      155. $g_aPreShape[1][1] = $PYRAMID_COLOUR
      156. $g_aPreShape[0][2] = $PYRAMID_COLOUR
      157. $g_aPreShape[1][2] = $PYRAMID_COLOUR
      158. $g_aPreShape[2][2] = $PYRAMID_COLOUR
      159. case 4
      160. $g_aPreShape[0][1] = $LLEANER_COLOUR
      161. $g_aPreShape[1][1] = $LLEANER_COLOUR
      162. $g_aPreShape[1][2] = $LLEANER_COLOUR
      163. $g_aPreShape[2][2] = $LLEANER_COLOUR
      164. case 5
      165. $g_aPreShape[2][1] = $RLEANER_COLOUR
      166. $g_aPreShape[1][1] = $RLEANER_COLOUR
      167. $g_aPreShape[1][2] = $RLEANER_COLOUR
      168. $g_aPreShape[0][2] = $RLEANER_COLOUR
      169. case 6
      170. $g_aPreShape[1][1] = $LKNIGHT_COLOUR
      171. $g_aPreShape[2][1] = $LKNIGHT_COLOUR
      172. $g_aPreShape[2][2] = $LKNIGHT_COLOUR
      173. $g_aPreShape[2][3] = $LKNIGHT_COLOUR
      174. case 7
      175. $g_aPreShape[2][1] = $RKNIGHT_COLOUR
      176. $g_aPreShape[1][1] = $RKNIGHT_COLOUR
      177. $g_aPreShape[1][2] = $RKNIGHT_COLOUR
      178. $g_aPreShape[1][3] = $RKNIGHT_COLOUR
      179. EndSwitch
      180. For $i = 0 To 3
      181. For $j = 0 To 3
      182. If $g_aPreShape[$i][$j] = $EMPTY_COLOUR Then
      183. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      184. Else
      185. GUICtrlSetBkColor($g_lblPreviewBoard[$i][$j], $g_aPreShape[$i][$j])
      186. EndIf
      187. Next
      188. Next
      189. EndFunc
      190. Func _MoveShapeLeft()
      191. _MoveShape(-1, 0)
      192. EndFunc
      193. Func _MoveShapeRight()
      194. _MoveShape(1, 0)
      195. EndFunc
      196. Func _MoveShapeDown()
      197. _MoveShape(0, 1)
      198. EndFunc
      199. Func _DropShape()
      200. AdlibDisable()
      201. AdlibEnable("_MoveShapeDown", 25)
      202. EndFunc
      203. Func _MoveShape($nMoveX, $nMoveY)
      204. Local $nCollision, $i, $j
      205. Local $bFilled, $x, $y
      206. Local $sScoreText, $nScore
      207. If _CollisionTest($nMoveX, $nMoveY) Then
      208. If $nMoveY = 1 Then
      209. If $g_nShapeY < 1 Then
      210. AdlibDisable()
      211. MsgBox(0, "AutoIT Tetris", "GAME OVER!")
      212. GUICtrlSetState($g_btnStart, $GUI_ENABLE)
      213. HotKeySet("{LEFT}")
      214. HotKeySet("{RIGHT}")
      215. HotKeySet("{DOWN}")
      216. HotKeySet("{SPACE}")
      217. Return
      218. Else
      219. For $i = 0 To 3
      220. For $j = 0 To 3
      221. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      222. $g_aBoard[$g_nShapeX+$i][$g_nShapeY+$j] = $g_aGameShape[$i][$j]
      223. EndIf
      224. Next
      225. Next
      226. For $j = 0 To ($BOARD_HEIGHT-1)
      227. $bFilled = True
      228. For $i = 0 To ($BOARD_WIDTH-1)
      229. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      230. $bFilled = False
      231. ExitLoop
      232. EndIf
      233. Next
      234. If $bFilled Then
      235. $sScoreText = GUICtrlRead($g_lblScore)
      236. $nScore = Number(StringRight($sScoreText, StringLen($sScoreText)-7))+10
      237. If Mod($nScore, 50) = 0 Then
      238. $g_nGameTick -= 10
      239. EndIf
      240. GUICtrlSetData($g_lblScore, "SCORE: " & $nScore)
      241. For $x = 0 To ($BOARD_WIDTH-1)
      242. For $y = $j To 1 Step -1
      243. $g_aBoard[$x][$y] = $g_aBoard[$x][$y-1]
      244. Next
      245. Next
      246. _RedrawGameBoard()
      247. EndIf
      248. Next
      249. AdlibDisable()
      250. _NewShape()
      251. _DrawGameShape()
      252. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      253. EndIf
      254. EndIf
      255. Else
      256. _DrawGameShape(True)
      257. If $nMoveX <> 0 Then $g_nShapeX += $nMoveX
      258. If $nMoveY <> 0 Then $g_nShapeY += $nMoveY
      259. _DrawGameShape()
      260. EndIf
      261. EndFunc
      262. Func _RotateShape()
      263. Local $i, $j, $aTempShape[4][4]
      264. For $i = 0 To 3
      265. For $j = 0 To 3
      266. $aTempShape[3-$j][$i] = $g_aGameShape[$i][$j]
      267. Next
      268. Next
      269. For $i = 0 To 3
      270. For $j = 0 To 3
      271. If $aTempShape[$i][$j] <> $EMPTY_COLOUR Then
      272. If ($g_nShapeX+$i) < 0 Or ($g_nShapeX+$i) > ($BOARD_WIDTH- 1) Or _
      273. ($g_nShapeY+$j) < 0 Or ($g_nShapeY+$j) > ($BOARD_HEIGHT-1) Then
      274. Return
      275. EndIf
      276. EndIf
      277. Next
      278. Next
      279. For $x = 0 To ($BOARD_WIDTH-1)
      280. For $y = 0 To ($BOARD_HEIGHT-1)
      281. If $x >= $g_nShapeX And $x < ($g_nShapeX+4) Then
      282. If $y >= $g_nShapeY And $y < ($g_nShapeY+4) Then
      283. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      284. If $aTempShape[$x-$g_nShapeX][$y-$g_nShapeY] <> $EMPTY_COLOUR Then
      285. Return
      286. EndIf
      287. EndIf
      288. EndIf
      289. EndIf
      290. Next
      291. Next
      292. _DrawGameShape(True)
      293. For $i = 0 To 3
      294. For $j = 0 To 3
      295. $g_aGameShape[$i][$j] = $aTempShape[$i][$j]
      296. Next
      297. Next
      298. _DrawGameShape()
      299. EndFunc
      300. Func _CollisionTest($nMoveX, $nMoveY)
      301. Local $nNewX = $g_nShapeX+$nMoveX
      302. Local $nNewY = $g_nShapeY+$nMoveY
      303. Local $i, $j, $x, $y
      304. For $i = 0 To 3
      305. For $j = 0 To 3
      306. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      307. If ($nNewX+$i) < 0 Or ($nNewX+$i) > ($BOARD_WIDTH-1) Or _
      308. ($nNewY+$j) < 0 Or ($nNewY+$j) > ($BOARD_HEIGHT-1) Then
      309. Return True
      310. EndIf
      311. EndIf
      312. Next
      313. Next
      314. For $x = 0 To ($BOARD_WIDTH-1)
      315. For $y = 0 To ($BOARD_HEIGHT-1)
      316. If $x >= $nNewX And $x < ($nNewX+4) Then
      317. If $y >= $nNewY And $y < ($nNewY+4) Then
      318. If $g_aBoard[$x][$y] <> $EMPTY_COLOUR Then
      319. If $g_aGameShape[$x-$nNewX][$y-$nNewY] <> $EMPTY_COLOUR Then
      320. Return True
      321. EndIf
      322. EndIf
      323. EndIf
      324. EndIf
      325. Next
      326. Next
      327. Return False
      328. EndFunc
      329. Func _DrawGameShape($bRemove = False)
      330. Local $i, $j
      331. For $i = 0 To 3
      332. For $j = 0 To 3
      333. If $g_aGameShape[$i][$j] <> $EMPTY_COLOUR Then
      334. If $bRemove Then
      335. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $GUI_BKCOLOR_TRANSPARENT)
      336. Else
      337. GUICtrlSetBkColor($g_lblGameBoard[$g_nShapeX+$i][$g_nShapeY+$j], $g_aGameShape[$i][$j])
      338. EndIf
      339. EndIf
      340. Next
      341. Next
      342. EndFunc
      343. Func _DrawGameBoard()
      344. Local $i, $j
      345. Local $x, $y
      346. $x = 20
      347. $y = 20
      348. For $i = 0 To $BOARD_WIDTH-1
      349. For $j = 0 To $BOARD_HEIGHT-1
      350. GUICtrlCreateLabel("", $x, $y, 25, 25)
      351. $g_lblGameBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      352. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      353. $y = $y+26
      354. Next
      355. $x = $x+26
      356. $y = 20
      357. Next
      358. EndFunc
      359. Func _DrawPreviewBoard()
      360. Local $i, $j
      361. Local $x, $y
      362. $x = 340
      363. $y = 40
      364. GUICtrlCreateLabel("Next Shape:", $x, 20, 104, 18)
      365. For $i = 0 To 3
      366. For $j = 0 To 3
      367. GUICtrlCreateLabel("", $x, $y, 25, 25)
      368. $g_lblPreviewBoard[$i][$j] = GUICtrlCreateLabel("", $x+1, $y+1, 23, 23)
      369. GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
      370. $y = $y+26
      371. Next
      372. $x = $x+26
      373. $y = 40
      374. Next
      375. EndFunc
      376. Func _RedrawGameBoard()
      377. Local $i, $j
      378. For $i = 0 To $BOARD_WIDTH-1
      379. For $j = 0 To $BOARD_HEIGHT-1
      380. If $g_aBoard[$i][$j] = $EMPTY_COLOUR Then
      381. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      382. Else
      383. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $g_aBoard[$i][$j])
      384. EndIf
      385. Next
      386. Next
      387. EndFunc
      388. Func _NewGame()
      389. Local $i, $j
      390. AdlibDisable()
      391. HotKeySet("{LEFT}", "_MoveShapeLeft")
      392. HotKeySet("{RIGHT}", "_MoveShapeRight")
      393. HotKeySet("{DOWN}", "_RotateShape")
      394. HotKeySet("{SPACE}", "_DropShape")
      395. $g_bGameStarted = False
      396. For $i = 0 To $BOARD_WIDTH-1
      397. For $j = 0 To $BOARD_HEIGHT-1
      398. $g_aBoard[$i][$j] = $EMPTY_COLOUR
      399. GUICtrlSetBkColor($g_lblGameBoard[$i][$j], $GUI_BKCOLOR_TRANSPARENT)
      400. Next
      401. Next
      402. _NewShape()
      403. $g_bGameStarted = True
      404. _DrawGameShape()
      405. $g_nGameTick = 500
      406. AdlibEnable("_MoveShapeDown", $g_nGameTick)
      407. EndFunc
      408. EndIf
      Alles anzeigen