Advertisement
Guest User

mazerungame2

a guest
Nov 22nd, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.86 KB | None | 0 0
  1. 'Kinda maze runner
  2. GraphicsWindow.Width =1080
  3. GraphicsWindow.Height = 720
  4. GraphicsWindow.KeyDown = OnKeyDown
  5. GraphicsWindow.Title = "Kinda Maze Run Game"
  6. GraphicsWindow.BackgroundColor = "#81F781"
  7.  
  8. start:
  9.  
  10. g1size=32
  11. g1 = Shapes.AddImage("C:\Users\deqnb\Desktop\Maze escape\stickcho.png")
  12. Controls.SetSize(g1, g1size, g1size)
  13. stepg1 = 20
  14. stepg = 5
  15. g2 = Shapes.AddImage("C:\Users\deqnb\Desktop\Maze escape\girl.png")
  16. Controls.SetSize(g2, g1size, g1size)
  17. g2locx = 1000
  18. g2locy = 650
  19. Shapes.move(g2, g2locx, g2locy)
  20.  
  21. wallsSize = -1
  22. wallStandartHight = 980 'дължината
  23. wallstandartWeight = 10 'ширината
  24. wallposex = 100
  25. wallposey = 50
  26. registerwall()
  27. wallposey = 150
  28. registerwall()
  29.  
  30.  
  31. 'левите числа са ми за позицията на ляво и надясно
  32. wall01 = Shapes.AddRectangle(wallStandartHight , wallstandartWeight)
  33. Shapes.Move (wall01, wallposex, wallposey)
  34. wall02 = Shapes.AddRectangle(wallStandartHight , wallstandartWeight)
  35. Shapes.Move (wall02, wallposex + 500 , wallposey - 30 )
  36. wall03 = Shapes.AddRectangle(wallStandartHight - 200, wallstandartWeight)
  37. Shapes.Move (wall03, wallposex - 200, wallposey + 60)
  38. wall04 = Shapes.AddRectangle(wallStandartHight - 800, wallstandartWeight)
  39. Shapes.Move (wall04, wallposex + 800, wallposey + 60)
  40. wall05 = Shapes.AddRectangle(wallStandartHight , wallstandartWeight)
  41. Shapes.Move (wall05, wallposex , wallposey + 150)
  42. vertwall = Shapes.AddRectangle( wallstandartWeight, wallStandartHight)
  43. Shapes.Move (vertwall , wallposex + 200, wallposey + 250 )
  44. vertwall02 = Shapes.AddRectangle( wallstandartWeight, wallStandartHight)
  45. Shapes.Move (vertwall02 , wallposex + 800, wallposey + 450 )
  46. vertwall03 = Shapes.AddRectangle( wallstandartWeight , wallStandartHight - 700)
  47. Shapes.Move (vertwall03 , wallposex + 100, wallposey + 130 )
  48. vertwall04 = Shapes.AddRectangle( wallstandartWeight , wallStandartHight - 700)
  49. Shapes.Move (vertwall04 , wallposex + 40, wallposey + 230 )
  50. vertwall05 = Shapes.AddRectangle( wallstandartWeight , 435)
  51. Shapes.Move (vertwall05 , 40, wallposey + 230 )
  52. wall06 = Shapes.AddRectangle(wallStandartHight - 500 , wallstandartWeight )
  53. Shapes.Move (wall06, 0 , wallposey + 560)
  54. wall07 = Shapes.AddRectangle(wallStandartHight - 800 , wallstandartWeight )
  55. Shapes.Move (wall07, 500 , wallposey + 460)
  56. vertwall06 = Shapes.AddRectangle( wallstandartWeight , 135)
  57. Shapes.Move (vertwall06 , 370, wallposey + 150 )
  58. wall08 = Shapes.AddRectangle(wallStandartHight - 800 , wallstandartWeight )
  59. Shapes.Move (wall08, 700 , 370)
  60. wall09 = Shapes.AddRectangle(wallStandartHight - 800 , wallstandartWeight )
  61. Shapes.Move (wall09, 300 , 470)
  62. wall10 = Shapes.AddRectangle(wallStandartHight - 800 , wallstandartWeight )
  63. Shapes.Move (wall10, 500 , 250)
  64. vertwall07 = Shapes.AddRectangle(wallstandartWeight ,wallStandartHight -700)
  65. Shapes.Move (vertwall07, 605, 355)
  66. vertwall08 = Shapes.AddRectangle(wallstandartWeight ,wallStandartHight -600)
  67. Shapes.Move (vertwall08, 805, 255)
  68. vertwall09 = Shapes.AddRectangle(wallstandartWeight ,wallStandartHight -900)
  69. Shapes.Move (vertwall09, 605, 187)
  70. wall11 = Shapes.AddRectangle(wallStandartHight - 100 , wallstandartWeight )
  71. Shapes.Move (wall11, 850 , 300)
  72. wall12 = Shapes.AddRectangle(wallStandartHight - 850 , wallstandartWeight )
  73. Shapes.Move (wall12, 100 , 500)
  74.  
  75.  
  76.  
  77. 'начи по някаква причина всичок след първите while и if не работи.
  78. 'пробвах при по-малък прототип на програмата, но пак се получи същото
  79.  
  80.  
  81.  
  82. Sub Registerwall
  83. wall01 = Shapes.AddRectangle(wallStandartHight , wallstandartWeight)
  84. Shapes.Move (wall01, wallposex, wallposey)
  85. wallsSize = wallsSize + 1
  86. walls[wallsSize]["x"]=wallposex
  87. walls[wallsSize]["y"]=wallposey
  88. walls[wallsSize]["height"]=wallStandartHight
  89. walls[wallsSize]["width"]=wallstandartWeight
  90. EndSub
  91.  
  92. Sub ChekForCollision
  93. For i = 0 To wallsSize
  94. cObX = walls[i]["x"]
  95. cObY = walls[i]["y"]
  96. cObW = walls[i]["width"]
  97. cObH = walls[i]["height"]
  98.  
  99. If x + g1size >= cObX And x <= cObX + cObX And y + g1size >= cObY and y <= cObY + cObH Then
  100. GraphicsWindow.ShowMessage("Загуби! " , "Опа" )
  101. GraphicsWindow.Clear()
  102. Goto start
  103. EndIf
  104. EndFor
  105. If x + g1Size >= g2LocX And x <= g2LocX + g1Size And y + g1Size >= g2LocY And y <= g2LocY + g1Size then
  106. GraphicsWindow.ShowMessage("Браво спечели играта!", "Поздравления")
  107. EndIf
  108. EndSub
  109.  
  110. Sub OnKeyDown
  111. y = Shapes.GetTop(g1)
  112. x = Shapes.GetLeft (g1)
  113.  
  114. 'lqvo
  115. If GraphicsWindow.LastKey = "Left" Then
  116. x = x - stepg
  117. EndIf
  118. 'dqsno
  119. If GraphicsWindow.LastKey = "Right"Then
  120. x = x + stepg
  121. EndIf
  122. 'gore
  123. If GraphicsWindow.LastKey = "Up"Then
  124. y = y - stepg
  125. EndIf
  126. 'dolu
  127. If GraphicsWindow.LastKey = "Down" Then
  128. y = y + stepg
  129. EndIf
  130. Shapes.Move (g1,x,y)
  131. EndSub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement