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.

scene_init.py 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. import bge
  2. import colors
  3. def main():
  4. import bge
  5. #import GameLogic
  6. cont = bge.logic.getCurrentController()
  7. own = cont.owner
  8. dict = bge.logic.globalDict
  9. #print("nnnnnnpause level", dict['level'])
  10. own['last_stBut'] = False
  11. level = dict['level']
  12. scene = bge.logic.getCurrentScene()
  13. cam = scene.objects['Camera.003']
  14. curscene = bge.logic.getCurrentScene()
  15. # scenes = bge.logic.getSceneList()
  16. # for scene in scenes :
  17. # if scene.name == 'main':
  18. # player = scene.objects['player']
  19. # main = bge.logic.getSceneList["main"]
  20. dict['overlay_fadeout'] = 1
  21. scenes = bge.logic.getSceneList()
  22. own['pre_pause_linvel'] = 0.0
  23. objList = scene.objects
  24. # get object named MainCharacter
  25. parent = objList["control_cube.002"]
  26. # combine child's shape with parent's
  27. compound = True
  28. obj = scene.objects['Char4']
  29. # child is solid
  30. ghost = False
  31. # set parent
  32. obj.setParent( parent, compound, ghost)
  33. parent.worldPosition.z += .5
  34. scene.gravity = [0,0,dict['gravity']]
  35. for i in scenes:
  36. if i.name == "main":
  37. main = i
  38. for i in scenes:
  39. if i.name == "fade_out":
  40. print('ending fade_out', scenes)
  41. scene2 = i
  42. scene2.end()
  43. if level == 'newday':
  44. brightness = 2.6
  45. cam['BC_BRIGHTNESS'] = 1.3
  46. cam['BC_CONTRAST'] = 1.5
  47. # elif level == 'lot':
  48. # brightness = 2.6
  49. # cam['BC_BRIGHTNESS'] = 1
  50. # cam['BC_CONTRAST'] = 1
  51. # #main.world.zenithColor = [1.0, .9, .975, 0]
  52. # #main.world.horizonColor = [.42, .555, .823, 0]
  53. # curscene.world.zenithColor = [1.0, .9, .975, 0]
  54. # curscene.world.horizonColor = [.42, .555, .823, 0]
  55. #print("sadfasdfsdfasdfasdfasdfasdfasdf")
  56. elif level == 'spine':
  57. brightness = 2.6
  58. cam['BC_BRIGHTNESS'] = .85
  59. cam['BC_CONTRAST'] = 1.1
  60. elif level == 'sc':
  61. print('setting color of', curscene)
  62. curscene.world.zenithColor = [.23, .23, .25, 1] #[0.1,.2,.4,.5]#[.58, .86, 1.0, 0] #[.3, 0.3, 0.3, 0]
  63. curscene.world.horizonColor = [.1, .15, .3, 1] #[0.1,0,0,1] #[.58, .86, 1.0, 1]
  64. elif level == 'garage18':
  65. print('setting color of', curscene)
  66. curscene.world.zenithColor = [0, 0.0, 0.0, 0]
  67. curscene.world.horizonColor = [0, 0, 0.0, 0]
  68. elif level == 'pats':
  69. print('setting color of', curscene)
  70. if dict['bc'] == 1:
  71. cont.activate(cam.actuators["bc"])
  72. else:
  73. cont.activate(cam.actuators["bc_off"])
  74. if dict['hdr'] == 1:
  75. cont.activate(cam.actuators["hdr"])
  76. else:
  77. cont.activate(cam.actuators["hdr_off"])
  78. if dict['ao'] == 1:
  79. cont.activate(cam.actuators["ao"])
  80. else:
  81. cont.activate(cam.actuators["ao_off"])
  82. if dict['dof_on'] == 1:
  83. cont.activate(cam.actuators["DOF"])
  84. else:
  85. cont.activate(cam.actuators["DOF_off"])
  86. if dict['bloom_on'] == 1:
  87. cont.activate(cam.actuators["Bloom"])
  88. else:
  89. cont.activate(cam.actuators["bloom_off"])
  90. # print(dict['shadow_on'], 'shadow_on')
  91. # if dict['shadow_on'] == 1:
  92. # bge.render.setGLSLMaterialSetting("shadows", 1)
  93. # else:
  94. # bge.render.setGLSLMaterialSetting("shadows", 0)
  95. if dict['music_player'] == 1:
  96. dict['music_start'] = True
  97. print('starting music')
  98. else:
  99. print('not starting music', dict['music_player'])
  100. scene.world.envLightEnergy = dict['ambient_strength']
  101. cam['BC_BRIGHTNESS'] = dict['BC_BRIGHTNESS']
  102. cam['BC_CONTRAST'] = dict['BC_CONTRAST']
  103. cam['bc'] = dict['bc']
  104. cam['hdr'] = dict['hdr']
  105. cam['avgL'] = dict['avgL']
  106. cam['HDRamount'] = dict['HDRamount']
  107. cam['ao'] = dict['ao']
  108. cam['onlyAO'] = dict['onlyAO']
  109. cam['aowidth'] = dict['aowidth']
  110. cam['aoradius'] = dict['aoradius']
  111. cam['ambient_strength'] = dict['ambient_strength']
  112. cam['sun_strength'] = dict['sun_strength']
  113. cam['sun_pos_x'] = dict['sun_rot_x']
  114. cam['sun_pos_y'] = dict['sun_rot_y']
  115. #cam['shadow_on'] = dict['shadow_on']
  116. cam['dof_on'] = dict['dof_on']
  117. cam['bloom_on'] = dict['bloom_on']
  118. cam['fxaa'] = dict['fxaa']
  119. cam['FXAA_SPAN_MAX'] = dict['FXAA_SPAN_MAX']
  120. own['grindnew_timer'] = 0
  121. own['last_ramp'] = 0
  122. own['requestAction'] = ''
  123. own['l_actionState'] = ''
  124. own['actionState'] = ''
  125. own['transition_timer'] = 0
  126. own['transitioning'] = 0
  127. own['driving'] = False
  128. dict['last_driving'] = False
  129. own['last_roty'] = 0.0
  130. own['walk_targ_speed'] = 2
  131. own['walk_fast_targ_speed'] = 5
  132. own['walk_speed'] = 0
  133. own['walk_inc'] = .05
  134. own['walk_jump_timer'] = 0
  135. own['no_grind_timer'] = 0
  136. own['last_jump_frame'] = 0
  137. colors.update_shirt_tex()
  138. colors.update_truck_tex()
  139. print('scene init ran')
  140. main()