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 4.5KB

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