Shuvit game master repo. http://shuvit.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pause.py 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. import bge
  2. cont = bge.logic.getCurrentController()
  3. own = cont.owner
  4. dict = bge.logic.globalDict
  5. lLR = dict['lLR']
  6. lUD = dict['lUD']
  7. rLR = dict['rLR']
  8. rUD = dict['rUD']
  9. lTrig = dict['lTrig']
  10. rTrig = dict['rTrig']
  11. aBut = dict['aBut']
  12. bBut = dict['bBut']
  13. xBut = dict['xBut']
  14. yBut = dict['yBut']
  15. lBump = dict['lBump']
  16. rBump = dict['rBump']
  17. bkBut = dict['bkBut']
  18. stBut = dict['stBut']
  19. xbBut = dict['xbBut']
  20. ltsBut = dict['ltsBut']
  21. rtsBut = dict['rtsBut']
  22. ldPad = dict['ldPad']
  23. rdPad = dict['rdPad']
  24. udPad = dict['udPad']
  25. ddPad = dict['ddPad']
  26. #print(lUD)
  27. axis_sens = .06
  28. #print(aBut)
  29. lasta = own["lasta"]
  30. if lUD > axis_sens: down = 1
  31. else: down = 0
  32. if lUD < -axis_sens:
  33. up = 1
  34. #print("up")
  35. else: up = 0
  36. #print(down, up)
  37. if lLR > axis_sens: right = 1
  38. else: right = 0
  39. if lLR < -axis_sens: left = 1
  40. else: left = 0
  41. fileName = "Settings.dat"
  42. scenes = bge.logic.getSceneList()
  43. #print(scenes)
  44. main_scene = [scene for scene in scenes if scene.name=="main"][0]
  45. main_empty = main_scene.objects['Empty']
  46. def main():
  47. cont = bge.logic.getCurrentController()
  48. own = cont.owner
  49. #down = cont.sensors["down"]
  50. #up = cont.sensors["up"]
  51. #bBut = cont.sensors["bBut"]
  52. #aBut = cont.sensors["aBut"]
  53. pstate = own["pstate"]
  54. scene = bge.logic.getCurrentScene()
  55. dict = bge.logic.globalDict
  56. # resume = scene.objects["resume"]
  57. # settings = scene.objects["settings"]
  58. #level = scene.objects["level"]
  59. # dict['level'] = level
  60. # levelselect = scene.objects["levelselect"]
  61. # restart = scene.objects["restart"]
  62. # exit = scene.objects["exit"]
  63. # submenu_on = own["submenu_on"]
  64. # level_text = scene.objects["level_text"]
  65. # level_text.resolution = 8
  66. lastup = own["lastup"]
  67. lastdown = own["lastdown"]
  68. lastleft = own["lastleft"]
  69. lastright = own["lastright"]
  70. lastpstate = own["lastpstate"]
  71. playspeed = 2
  72. #sSelect = cont.actuators["sSelect"]
  73. cont.deactivate(own.actuators['restart'])
  74. #joy down
  75. # if down == 1 and lastdown != 1:
  76. # #own.stopAction(0)
  77. # pstate = own["pstate"]
  78. #
  79. # if pstate == 0 and submenu_on == 0:
  80. # resume.playAction("p_resume", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  81. # if pstate == 1 and submenu_on == 0:
  82. # settings.playAction("p_settings", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  83. # if pstate == 2 and submenu_on == 0:
  84. # level.playAction("p_level", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  85. # #level.playAction("p_level_select", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  86. # if pstate == 3 and submenu_on == 0:
  87. # restart.playAction("p_restart", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  88. # if pstate == 4 and submenu_on == 0:
  89. # exit.playAction("p_exit", 10,0, layer=1, priority=0, play_mode=0, speed=playspeed)
  90. #
  91. # if pstate < 4 and submenu_on == 0:
  92. # own["pstate"] = own["pstate"] + 1
  93. # if pstate == 4 and submenu_on == 0:
  94. # own["pstate"] = 0
  95. # pstate = own["pstate"]
  96. # #print(pstate)
  97. # cont.activate(own.actuators['sSelect'])
  98. # #joy up
  99. # if up == 1 and lastup != 1:
  100. # pstate = own["pstate"]
  101. #
  102. # if pstate == 0 and submenu_on == 0:
  103. # resume.playAction("p_resume", 10,0, layer=0, priority=0, play_mode=0, speed=playspeed)
  104. # if pstate == 1 and submenu_on == 0:
  105. # settings.playAction("p_settings", 10,0, layer=0, priority=0, play_mode=0, speed=playspeed)
  106. # if pstate == 2 and submenu_on == 0:
  107. # level.playAction("p_level", 10,0, layer=0, priority=0, play_mode=0, speed=playspeed)
  108. # if pstate == 3 and submenu_on == 0:
  109. # restart.playAction("p_restart", 10,0, layer=0, priority=0, play_mode=0, speed=playspeed)
  110. # if pstate == 4 and submenu_on == 0:
  111. # exit.playAction("p_exit", 10,0, layer=0, priority=0, play_mode=0, speed=playspeed)
  112. #
  113. #
  114. # if pstate > 0 and submenu_on == 0:
  115. # own["pstate"] = own["pstate"] - 1
  116. # if pstate == 0 and submenu_on == 0:
  117. # own["pstate"] = 4
  118. # pstate = own["pstate"]
  119. # #print(pstate)
  120. # cont.activate(own.actuators['sSelect'])
  121. # if right == 1 and lastright !=1:
  122. # cont.activate(own.actuators['sSelect'])
  123. # if left == 1 and lastleft != 1:
  124. # cont.activate(own.actuators['sSelect'])
  125. #level*****************************************************
  126. # if own["submenu"] == "level":
  127. # #print("submenu is level")
  128. # active_level_select = own["active_level_select"]
  129. #
  130. # import Settings
  131. # if left == 1 and lastleft != 1:
  132. # if active_level_select >= 0:
  133. # active_level_select -= 1
  134. # if active_level_select < 0:
  135. # active_level_select = 8
  136. # #if active_level_select == -1:
  137. # #active_level_select = 0
  138. # #print(active_level_select)
  139. # #move up
  140. # #play up
  141. # if right == 1 and lastright != 1:
  142. # if active_level_select < 9:
  143. # active_level_select += 1
  144. # if active_level_select == 9:
  145. # active_level_select = 0
  146. # if active_level_select == -1:
  147. # active_level_select = 0
  148. # #print(active_level_select)
  149. # #move down
  150. # #play down
  151. # if active_level_select == 0:
  152. # level_text.text = "Empty Lot"
  153. # if active_level_select == 1:
  154. # level_text.text = "Waterfall"
  155. # if active_level_select == 2:
  156. # level_text.text = "Warehouse"
  157. # if active_level_select == 3:
  158. # level_text.text = "City"
  159. # if active_level_select == 4:
  160. # level_text.text = "Training"
  161. # if active_level_select == 5:
  162. # level_text.text = "Spine"
  163. # if active_level_select == 6:
  164. # level_text.text = "Apricot Park"
  165. # if active_level_select == 7:
  166. # level_text.text = "Newday Bowl"
  167. # if active_level_select == 8:
  168. # level_text.text = "Garage 18"
  169. # own["active_level_select"] = active_level_select
  170. # load_timer = 100
  171. ##indoor
  172. # if aBut == False and active_level_select == 0 and lasta == 1:
  173. # level_text.text = ""
  174. # cont.activate(own.actuators['loading'])
  175. # level = "lot"
  176. # main_empty["level"] = "lot"
  177. # own["level"] = level
  178. # Settings.writeSettings()
  179. # #print("not")
  180. # Settings.readSettings()
  181. # #cont.activate(own.actuators['restart'])
  182. # dict['reload_timer'] = 250
  183. # dict['overlay_fadein'] = 1
  184. # #Settings.loadlevel()
  185. # dict['load_timer'] = load_timer
  186. # else:
  187. #
  188. # cont.deactivate(own.actuators['restart'])
  189. ##woodbowl
  190. # if aBut == False and active_level_select == 1 and lasta == 1:
  191. # level_text.text = ""
  192. # #cont.activate(own.actuators['loading'])
  193. # level = "mini_scene"
  194. # main_empty["level"] = "mini_scene"
  195. # own["level"] = level
  196. # Settings.writeSettings()
  197. # Settings.readSettings()
  198. # #cont.activate(own.actuators['restart'])
  199. # dict['reload_timer'] = 250
  200. # dict['overlay_fadein'] = 1
  201. # #Settings.loadlevel()
  202. # dict['load_timer'] = load_timer
  203. # else: cont.deactivate(own.actuators['restart'])
  204. ##mini
  205. # if aBut == False and active_level_select == 2 and lasta == 1:
  206. # level_text.text = ""
  207. # #cont.activate(own.actuators['loading'])
  208. # level = "warehouse"
  209. # main_empty["level"] = "warehouse"
  210. # own["level"] = level
  211. # Settings.writeSettings()
  212. # Settings.readSettings()
  213. # #cont.activate(own.actuators['restart'])
  214. # dict['reload_timer'] = 250
  215. # dict['overlay_fadein'] = 1
  216. # #Settings.loadlevel()
  217. # dict['load_timer'] = load_timer
  218. # else: cont.deactivate(own.actuators['restart'])
  219. ##level3
  220. # if aBut == False and active_level_select == 3 and lasta == 1:
  221. # level_text.text = ""
  222. # level = "city2"
  223. # main_empty["level"] = "city2"
  224. # own["level"] = level
  225. # Settings.writeSettings()
  226. # Settings.readSettings()
  227. # #cont.activate(own.actuators['restart'])
  228. # dict['reload_timer'] = 250
  229. # dict['overlay_fadein'] = 1
  230. # #Settings.loadlevel()
  231. # dict['load_timer'] = load_timer
  232. # else: cont.deactivate(own.actuators['restart'])
  233. ##hubbas rail
  234. # if aBut == False and active_level_select == 4 and lasta == 1:
  235. # level_text.text = ""
  236. # level = "train"
  237. # main_empty["level"] = "train"
  238. # own["level"] = level
  239. # Settings.writeSettings()
  240. # Settings.readSettings()
  241. # #cont.activate(own.actuators['restart'])
  242. # dict['reload_timer'] = 250
  243. # dict['overlay_fadein'] = 1
  244. # #Settings.loadlevel()
  245. # dict['load_timer'] = load_timer
  246. # else: cont.deactivate(own.actuators['restart'])
  247. ##training
  248. # if aBut == False and active_level_select == 5 and lasta == 1:
  249. # level_text.text = ""
  250. # level = "spine"
  251. # main_empty["level"] = "spine"
  252. # own["level"] = level
  253. # Settings.writeSettings()
  254. # Settings.readSettings()
  255. # #cont.activate(own.actuators['restart'])
  256. # dict['reload_timer'] = 250
  257. # dict['overlay_fadein'] = 1
  258. # #Settings.loadlevel()
  259. # dict['load_timer'] = load_timer
  260. # else: cont.deactivate(own.actuators['restart'])
  261. # if aBut == False and active_level_select == 6 and lasta == 1:
  262. # level_text.text = ""
  263. # level = "gt"
  264. # main_empty["level"] = "gt"
  265. # own["level"] = level
  266. # Settings.writeSettings()
  267. # Settings.readSettings()
  268. # #cont.activate(own.actuators['restart'])
  269. # dict['reload_timer'] = 250
  270. # dict['overlay_fadein'] = 1
  271. # #Settings.loadlevel()
  272. # dict['load_timer'] = load_timer
  273. # else: cont.deactivate(own.actuators['restart'])
  274. # if aBut == False and active_level_select == 7 and lasta == 1:
  275. # level_text.text = ""
  276. # level = "newday"
  277. # main_empty["level"] = "newday"
  278. # own["level"] = level
  279. # Settings.writeSettings()
  280. # Settings.readSettings()
  281. # #cont.activate(own.actuators['restart'])
  282. # dict['reload_timer'] = 250
  283. # dict['overlay_fadein'] = 1
  284. # #Settings.loadlevel()
  285. # dict['load_timer'] = load_timer
  286. # else: cont.deactivate(own.actuators['restart'])
  287. # if aBut == False and active_level_select == 8 and lasta == 1:
  288. # level_text.text = ""
  289. # level = "garage18"
  290. # main_empty["level"] = "garage18"
  291. # own["level"] = level
  292. # Settings.writeSettings()
  293. # Settings.readSettings()
  294. # #cont.activate(own.actuators['restart'])
  295. # #Settings.loadlevel()
  296. # dict['load_timer'] = load_timer
  297. # dict['reload_timer'] = 250
  298. # dict['overlay_fadein'] = 1
  299. # else: cont.deactivate(own.actuators['restart'])
  300. # else:
  301. # own["active_level_select"] = -1
  302. # if bBut == True:
  303. # levelselect.playAction("p_level_select", 10,0, layer=3, priority=0, play_mode=0, speed=playspeed)
  304. #**********************************************************
  305. # if pstate == 0 and submenu_on == 0 and lastpstate != 0:
  306. # resume.playAction("p_resume", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  307. # if pstate == 1 and submenu_on == 0 and lastpstate != 1:
  308. # settings.playAction("p_settings", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  309. # if pstate == 2 and submenu_on == 0 and lastpstate != 2:
  310. # level.playAction("p_level", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  311. # #level.playAction("p_level_select", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  312. # if pstate == 3 and submenu_on == 0 and lastpstate != 3:
  313. # restart.playAction("p_restart", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  314. # if pstate == 4 and submenu_on == 0 and lastpstate != 4:
  315. # exit.playAction("p_exit", -10,10, layer=0, priority=0, play_mode=0, speed=playspeed)
  316. #find the scene and object
  317. scenes = bge.logic.getSceneList()
  318. for scene in scenes :
  319. #if scene.name == 'lot' or scene.name == 'train' or scene.name == 'mini_scene' or scene.name == 'city' or scene.name == 'city2' or scene.name == 'spine':
  320. #if scene.name == main_empty["level"]:
  321. if scene.name == 'lot':
  322. #print("*****stop sounds")
  323. cc = scene.objects['control_cube.002']
  324. cc.actuators["sroll"].volume = .0001
  325. #cc.deactivate(own.actuators["sroll"])
  326. cc.actuators["sroll"].stopSound()
  327. #print(pstate)
  328. own["lastup"] = up
  329. own["lastdown"] = down
  330. own["lastleft"] = left
  331. own["lastright"] = right
  332. own["lasta"] = aBut
  333. own["lastpstate"] = own["pstate"]
  334. main()