Browse Source

replay sound fix

shuvit 6 months ago
parent
commit
3dd05750d4
54 changed files with 1350 additions and 948 deletions
  1. 0
    3
      assets/levels/user2.blend
  2. 3
    0
      assets/maps/Demo/map.blend
  3. 7
    0
      assets/maps/Demo/map_settings.ini
  4. 3
    0
      assets/maps/Frank's Garage/map.blend
  5. 7
    0
      assets/maps/Frank's Garage/map_settings.ini
  6. 3
    0
      assets/maps/Harry's Garage/map.blend
  7. 7
    0
      assets/maps/Harry's Garage/map_settings.ini
  8. 0
    0
      assets/maps/John's Mini/map.blend
  9. 7
    0
      assets/maps/John's Mini/map_settings.ini
  10. 0
    0
      assets/maps/Scratch/map.blend
  11. 7
    0
      assets/maps/Scratch/map_settings.ini
  12. 2
    2
      assets/materials/base_m_kit.blend
  13. 3
    0
      assets/materials/textures/Ceiling_A.png
  14. 3
    0
      assets/materials/textures/Ceiling_N.png
  15. 3
    0
      assets/materials/textures/Grunge_Masks_A.png
  16. 3
    0
      assets/materials/textures/bricks.png
  17. 3
    0
      assets/materials/textures/bricks_h.png
  18. 3
    0
      assets/materials/textures/bricks_hnb.png
  19. 3
    0
      assets/materials/textures/color_grid.png
  20. 3
    0
      assets/materials/textures/greyscale-pxb.png
  21. 3
    0
      assets/materials/textures/plywood_m_a.jpg
  22. 3
    0
      assets/materials/textures/plywood_m_d.jpg
  23. 3
    0
      assets/materials/textures/plywood_m_h.jpg
  24. 3
    0
      assets/materials/textures/plywood_m_hb.jpg
  25. 3
    0
      assets/materials/textures/plywood_m_hn.jpg
  26. 3
    0
      assets/materials/textures/plywood_m_ln.jpg
  27. 3
    0
      assets/materials/textures/plywood_m_mn.jpg
  28. 3
    0
      assets/materials/textures/plywood_m_n.jpg
  29. 3
    0
      assets/materials/textures/plywood_m_s.jpg
  30. 3
    0
      assets/materials/textures/plywood_m_sn.jpg
  31. 2
    2
      assets/ramps.blend
  32. 2
    2
      assets/user2.blend
  33. 3
    0
      assets/walls.blend
  34. 17
    16
      config.ini
  35. 4
    2
      scripts/FSM.py
  36. 11
    11
      scripts/Record.py
  37. 58
    5
      scripts/Settings.py
  38. 3
    1
      scripts/Startup.py
  39. 22
    0
      scripts/StatesGame.py
  40. 741
    708
      scripts/StatesPlayer.py
  41. 3
    3
      scripts/actionsFSMlist.py
  42. 12
    1
      scripts/boneRecord.py
  43. 6
    4
      scripts/controller2.py
  44. 12
    2
      scripts/game.py
  45. 25
    18
      scripts/grindV2.py
  46. 12
    0
      scripts/levelLibload.py
  47. 37
    16
      scripts/menuV3.py
  48. 2
    1
      scripts/npause.py
  49. 29
    27
      scripts/pause_menu2.py
  50. 214
    111
      scripts/player.py
  51. 11
    3
      scripts/ragdoll.py
  52. 8
    2
      scripts/scene_init.py
  53. 14
    6
      scripts/sound_man.py
  54. 2
    2
      shuvit.blend

+ 0
- 3
assets/levels/user2.blend View File

@@ -1,3 +0,0 @@
1
-version https://git-lfs.github.com/spec/v1
2
-oid sha256:0536309cdac72fe106d4ca3b9a6f268d02831c90346df3de24d98991dc01339d
3
-size 1211092

+ 3
- 0
assets/maps/Demo/map.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:e1d0e6eb4384dfac57c52a9c44ea29ae1eace79c57576ea0184171fa5d834c78
3
+size 531092

+ 7
- 0
assets/maps/Demo/map_settings.ini View File

@@ -0,0 +1,7 @@
1
+#shuvit map settings configuration file
2
+
3
+#lighting template
4
+map_template = outdoor_ns
5
+
6
+map_npcs = 0
7
+map_cars = 15

+ 3
- 0
assets/maps/Frank's Garage/map.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:773add811d95e272e288d1dfa8b2c60f33b0515fd9aac7bfbc823123b9b59706
3
+size 722880

+ 7
- 0
assets/maps/Frank's Garage/map_settings.ini View File

@@ -0,0 +1,7 @@
1
+#shuvit map settings configuration file
2
+
3
+#lighting template
4
+map_template = indoor
5
+
6
+map_npcs = 0
7
+map_cars = 15

+ 3
- 0
assets/maps/Harry's Garage/map.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:d5ab8c6a47a00cb392f712d07430dad963d1af3e6fb6bd1d3ea4dd0fa554a0f3
3
+size 1212232

+ 7
- 0
assets/maps/Harry's Garage/map_settings.ini View File

@@ -0,0 +1,7 @@
1
+#shuvit map settings configuration file
2
+
3
+#lighting template
4
+map_template = indoor
5
+
6
+map_npcs = 0
7
+map_cars = 15

assets/levels/mini/user2.blend → assets/maps/John's Mini/map.blend View File


+ 7
- 0
assets/maps/John's Mini/map_settings.ini View File

@@ -0,0 +1,7 @@
1
+#shuvit map settings configuration file
2
+
3
+#lighting template
4
+map_template = outdoor
5
+
6
+map_npcs = 0
7
+map_cars = 15

assets/levels/scratch/level.blend → assets/maps/Scratch/map.blend View File


+ 7
- 0
assets/maps/Scratch/map_settings.ini View File

@@ -0,0 +1,7 @@
1
+#shuvit map settings configuration file
2
+
3
+#lighting template
4
+map_template = outdoor
5
+
6
+map_npcs = 0
7
+map_cars = 15

+ 2
- 2
assets/materials/base_m_kit.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:c182c5eb0c2bd584a523fab0cd26dd30cb10a2b852eec3513da70bac981703df
3
-size 35791236
2
+oid sha256:a2e299b71b355f6f71238d6d39eb243687732cda57a536db004b593a042f5977
3
+size 35932972

+ 3
- 0
assets/materials/textures/Ceiling_A.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:633fa590e8f749a9c058a9553bf512bf1f9899e4f2ce1bafcc85b30c4ed93e2a
3
+size 1944896

+ 3
- 0
assets/materials/textures/Ceiling_N.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:ca9829ea155ba80572be65ffc23492ac4244140105897ea3c4d6bfbd618f7b0a
3
+size 1750847

+ 3
- 0
assets/materials/textures/Grunge_Masks_A.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:5618ce49202765378f412e556850a36a7ae1e0eb18c69d82868050818f67dccc
3
+size 1657326

+ 3
- 0
assets/materials/textures/bricks.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:f43e3e11c767afc56b9f250f2b93dd6068ec5f087af7242aed90a779c790b0b4
3
+size 528249

+ 3
- 0
assets/materials/textures/bricks_h.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:3eaaee418f491c0c8b911a970f8a31167a17b941fe80df4b9e1b95768b7927a2
3
+size 231818

+ 3
- 0
assets/materials/textures/bricks_hnb.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:51b7237418626912ca3fae3bf6510ca839296a30620bdab7c30fb3e0e11ca089
3
+size 754969

+ 3
- 0
assets/materials/textures/color_grid.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:5fc4b73b2fdda62dc09e25a8614072d5b5021738b51e93e157931d23c07f8275
3
+size 4624

+ 3
- 0
assets/materials/textures/greyscale-pxb.png View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:1d933843b33401c385dfa8201381f4eef4da35a589916c40a981e299551901bb
3
+size 637110

+ 3
- 0
assets/materials/textures/plywood_m_a.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:51aa200ddd45fef473de251882048149d8dc8e1f65f96b8e299c76b5551c3921
3
+size 496720

+ 3
- 0
assets/materials/textures/plywood_m_d.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:25dcf970b3fceda59dfc9ac22871994a2b6f6a4577e9479d98a7bb4a31f6a57a
3
+size 446995

+ 3
- 0
assets/materials/textures/plywood_m_h.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:0daf050a331bab951d2da760704bffd6be67a1d607744175a844e176ce6feaaf
3
+size 196285

+ 3
- 0
assets/materials/textures/plywood_m_hb.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:6334aad32ad862c62ec1fcd4b75ec4d1dec330754c0d9d10d840a98271b9b07d
3
+size 240274

+ 3
- 0
assets/materials/textures/plywood_m_hn.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:3da31787d46ef5794691f56027f903567ebec19983a92cfe68c77d677d0b1684
3
+size 1424429

+ 3
- 0
assets/materials/textures/plywood_m_ln.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:0b55fbf2d677bfd0832f7b51b3af69f375962a3e70092a3aaa3fe437000f578e
3
+size 592079

+ 3
- 0
assets/materials/textures/plywood_m_mn.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:f372bc45c7495145f882066e049c0a5551d4604a370c1e56bc26fe66eb23b0d6
3
+size 652208

+ 3
- 0
assets/materials/textures/plywood_m_n.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:ad6679ca69850c1005a42d1e8772bbb451796ca5bf43ea8b204f1bc140a0312d
3
+size 774878

+ 3
- 0
assets/materials/textures/plywood_m_s.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:88bd5b070da8edf56529f901d9b7576bc3bd4a209741277d1a6cbdf3638fb672
3
+size 617364

+ 3
- 0
assets/materials/textures/plywood_m_sn.jpg View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:c9207662a798c9286a828c8b6528fe92fb1f6edc71c268c3e1826a5325085e22
3
+size 341161

+ 2
- 2
assets/ramps.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:7f0ca585c24b56ca66641f6ebeec9b3525f19f757b6857a8c1ac9fb957421066
3
-size 80413544
2
+oid sha256:5f79f92570790b1dce9967d31066953686e966be6e24f8cea739475130b5dcb6
3
+size 84686084

+ 2
- 2
assets/user2.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:591f877f598327200b89c9518b9ba7e8aaefe0f5b69957836fbf0044cb26b5e5
3
-size 3442504
2
+oid sha256:290945cb39568c3ecffdfe59a94d188c0e20dd7eac5b7c33c4b4393a396d6fac
3
+size 3403128

+ 3
- 0
assets/walls.blend View File

@@ -0,0 +1,3 @@
1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:50275c1ba939f8e547bf590f50357cfd10bd80d8adf9a241443ccf39df76ae82
3
+size 7128536

+ 17
- 16
config.ini View File

@@ -21,8 +21,9 @@ vsync_on = 0
21 21
 
22 22
 #level
23 23
 ######
24
-level = user2
25
-levelBlend = user2
24
+level = indoor
25
+levelBlend = indoor
26
+map = Harry's Garage
26 27
 #------------
27 28
 
28 29
 #replay recorder
@@ -34,7 +35,7 @@ recorder_on = 1
34 35
 #camera 
35 36
 #######
36 37
 cam_height = -0.3
37
-focal_length = 12
38
+focal_length = 10
38 39
 cam_min = 2.0
39 40
 cam_max = 4.4
40 41
 cch_targetHeight = 0.3
@@ -54,13 +55,13 @@ character = ken
54 55
 
55 56
 shirt_logo = 2
56 57
 
57
-shirt_color_r = 0
58
-shirt_color_g = 0
59
-shirt_color_b = 0
58
+shirt_color_r = 1
59
+shirt_color_g = 0.03
60
+shirt_color_b = 0.03
60 61
 
61
-shoe_color_r = 0.69
62
-shoe_color_g = 0.69
63
-shoe_color_b = 0.67
62
+shoe_color_r = 1
63
+shoe_color_g = 0.38
64
+shoe_color_b = 0
64 65
 #-----------------
65 66
 
66 67
 #deck settings
@@ -96,12 +97,12 @@ BC_BRIGHTNESS = 1.1
96 97
 BC_CONTRAST = 1.09
97 98
 
98 99
 #HDR
99
-hdr = 0
100
-avgL = 0.8
100
+hdr = 1
101
+avgL = 0.69
101 102
 HDRamount = 0.05
102 103
 
103 104
 #Ambient Occlusion
104
-ao = 0
105
+ao = 1
105 106
 onlyAO = 0
106 107
 aowidth = 0.2
107 108
 aoradius = 2.4
@@ -119,10 +120,10 @@ FXAA_SPAN_MAX = 8.0
119 120
 
120 121
 #sun settings
121 122
 #############
122
-sun_strength = 1.05
123
-ambient_strength = 0.15
124
-sun_rot_x = 0.05
125
-sun_rot_y = 0.05
123
+sun_strength = 1.1
124
+ambient_strength = 0.18
125
+sun_rot_x = -0.05
126
+sun_rot_y = -0.05
126 127
 shadow_on = 0
127 128
 #------------
128 129
 

+ 4
- 2
scripts/FSM.py View File

@@ -74,7 +74,8 @@ class GameFSM(Char):
74 74
         'Startup',
75 75
         'Initer',
76 76
         'LoadLevel',
77
-        'GameOn']
77
+        'GameOn',
78
+        'Reload']
78 79
         
79 80
         for s in state_list:
80 81
             self.FSM.AddState(s, getattr(StatesGame, s)(self.FSM))
@@ -109,7 +110,8 @@ class PlayerFSM(Char):
109 110
         'Offboard', 
110 111
         'Dropin',
111 112
         'Roll',
112
-        'Ragdoll']
113
+        'Ragdoll',
114
+        'Pause']
113 115
         
114 116
         for s in state_list:
115 117
             self.FSM.AddState(s, getattr(StatesPlayer, s)(self.FSM))

+ 11
- 11
scripts/Record.py View File

@@ -325,19 +325,19 @@ def loadData():
325 325
     lengthVis = own["lengthVis"]
326 326
     
327 327
     if lengthVis:
328
+        pass
329
+        # if valueIndex > lengthVis-1:
330
+        #     own["valueIndex"] = 0
331
+        # if objIndex < 0:
332
+        #     own["objIndex"] = lengthVis-2
328 333
 
329
-        if valueIndex > lengthVis-1:
330
-            own["valueIndex"] = 0
331
-        if objIndex < 0:
332
-            own["objIndex"] = lengthVis-2
333
-
334
-        name, visible = readData.returnVisibility(objIndex, valueIndex)
334
+        # name, visible = readData.returnVisibility(objIndex, valueIndex)
335 335
         
336
-        if name in scene.objects:
337
-            try:
338
-                scene.objects[name].visible = int(visible)
339
-            except:
340
-                pass
336
+        # if name in scene.objects:
337
+        #     try:
338
+        #         scene.objects[name].visible = int(visible)
339
+        #     except:
340
+        #         pass
341 341
     #-----Skater Animation Name-----#
342 342
     own["lengthSkaterAnim"] = readData.getLengthSkaterAnim()
343 343
     lengthSkaterAnim = own["lengthSkaterAnim"]

+ 58
- 5
scripts/Settings.py View File

@@ -8,10 +8,31 @@ fileName = mainDir + "config.ini"
8 8
 
9 9
 config = ConfigObj(fileName, interpolation=True)
10 10
 dict = bge.logic.globalDict
11
+#map_config = {}
12
+
11 13
 
12 14
 print('###############start game##########')
13 15
 dict['music_player'] = 1
14 16
 
17
+def to_dict3(section, key):
18
+    #dict = bge.logic.globalDict
19
+    print(section, key)
20
+    #d = dict['map']
21
+    fileName2 = GameLogic.expandPath("//assets/maps/" + dict['map'] + '/map_settings.ini')    
22
+    map_config = ConfigObj(fileName2, interpolation=True)   
23
+    value = map_config[key]
24
+    if isinstance(value, str):
25
+        if value.isdigit():
26
+            value = int(value)
27
+        else:
28
+            try:
29
+                value = float(value)
30
+            except:
31
+                pass
32
+    #print(dict['mapDict'])
33
+    dict[key] = value    
34
+
35
+
15 36
 def to_dict(section, key):
16 37
     dict = bge.logic.globalDict
17 38
     value = config[key]
@@ -24,8 +45,28 @@ def to_dict(section, key):
24 45
             except:
25 46
                 pass
26 47
     dict[key] = value  
27
-    #print(key, value)
48
+
28 49
     
50
+def readMap():
51
+    fileName = GameLogic.expandPath("//assets/maps/" + dict['map'] + '/map_settings.ini')    
52
+    #fileName = mainDir + dict['character'] + ".ini"
53
+    #print('loading character settings', fileName)
54
+    map_config = ConfigObj(fileName, interpolation=True)
55
+    print('map_config', map_config)
56
+    dict['mapDict'] = map_config
57
+    # def to_dict2(section, key):
58
+    #     #dict = bge.logic.globalDict
59
+    #     value = map_config[key]
60
+    #     if isinstance(value, str):
61
+    #         if value.isdigit():
62
+    #             value = int(value)
63
+    #         else:
64
+    #             try:
65
+    #                 value = float(value)
66
+    #             except:
67
+    #                 pass
68
+    #     dict[key] = value 
69
+
29 70
 def readChar():
30 71
     mainDir = GameLogic.expandPath("//characters/")    
31 72
     fileName = mainDir + dict['character'] + ".ini"
@@ -66,7 +107,12 @@ def writeChar():
66 107
     
67 108
 
68 109
 def readSettings():
69
-    config.walk(to_dict)         
110
+    config.walk(to_dict)    
111
+    dict['mapDict'] = {}  
112
+    fileName2 = GameLogic.expandPath("//assets/maps/" + dict['map'] + '/map_settings.ini')    
113
+    map_config = ConfigObj(fileName2, interpolation=True)   
114
+    map_config.walk(to_dict3)         
115
+    #readMap()
70 116
     readChar()
71 117
 
72 118
 def from_dict(section, key):
@@ -117,9 +163,16 @@ def loadlevel():
117 163
     if own["profile"] ==1:    
118 164
         bge.render.showProfile(1)   
119 165
     act = own2.actuators["level"]
120
-    dict = bge.logic.globalDict
121
-    level = dict['level']
122
-    print('loading level', level)
166
+    #dict = bge.logic.globalDict
167
+    
168
+    fileName2 = GameLogic.expandPath("//assets/maps/" + dict['map'] + '/map_settings.ini')    
169
+    map_config = ConfigObj(fileName2, interpolation=True)   
170
+    map_config.walk(to_dict3)  
171
+    
172
+    level = dict['map_template']
173
+    dict['level'] = level
174
+    #level = dict['level']
175
+    print('loading template level', level)
123 176
     act.scene = level 
124 177
     cont.activate(own2.actuators["level"]) 
125 178
     dict['npause'] = False 

+ 3
- 1
scripts/Startup.py View File

@@ -103,12 +103,14 @@ def main(cont):
103 103
     dict['sunz'] = 1.0 
104 104
     dict['replay_loop_start'] = 0
105 105
     dict['replay_loop_end'] = 0
106
-    dict['replay_record_length'] = 7300#240 #1200 #7300
106
+    dict['replay_record_length'] = 2600#240 #1200 #7300
107 107
     dict['rp_keyframes'] = []
108 108
     dict['rp_positions'] = []
109 109
     dict['temp_list'] = []
110 110
     dict['scene_inited'] = True
111 111
     dict['p1c'] = None
112
+    dict['sun_lights'] = []
113
+    dict['ambient_lights'] = []
112 114
 
113 115
     dict['joy_con'] = False
114 116
     

+ 22
- 0
scripts/StatesGame.py View File

@@ -5,6 +5,8 @@ import Startup as S2
5 5
 import Settings
6 6
 import inputs
7 7
 import logo_fades
8
+
9
+dict = bge.logic.globalDict
8 10
 #====================================     
9 11
 
10 12
 State = type("State", (object,), {})
@@ -130,4 +132,24 @@ class GameOn(State):
130 132
     def Exit(self):
131 133
         pass
132 134
 
135
+#==================================== 
136
+
137
+class Reload(State):
138
+    def __init__(self,FSM):
139
+        super(Reload, self).__init__(FSM)    
140
+        
141
+    def Enter(self):
142
+        self.FSM.stateLife = 1
143
+        super(Reload, self).Enter()        
144
+        
145
+    def Execute(self):
146
+        self.FSM.stateLife += 1
147
+        dict.clear()
148
+        self.FSM.owner['cont'].activate(self.FSM.owner['cont'].actuators['restart'])
149
+        #cont.activate(own.actuators['add_fade'])  
150
+        #own['cont'] = cont
151
+
152
+    def Exit(self):
153
+        pass
154
+
133 155
 #==================================== 

+ 741
- 708
scripts/StatesPlayer.py View File

@@ -6,767 +6,800 @@ import sound_man
6 6
 State = type("State", (object,), {})
7 7
 #====================================     
8 8
 class State(object):
9
-    def __init__(self, FSM):
10
-        self.FSM = FSM
11
-        self.timer = 0
12
-        self.startTime = 0
13
-    def Enter(self):
14
-        self.timer = 0
15
-        self.startTime = 0
16
-    def Execute(self):
17
-        print('Executing')
18
-    def Exit(self):
19
-        print('Exiting')
9
+	def __init__(self, FSM):
10
+		self.FSM = FSM
11
+		self.timer = 0
12
+		self.startTime = 0
13
+	def Enter(self):
14
+		self.timer = 0
15
+		self.startTime = 0
16
+	def Execute(self):
17
+		print('Executing')
18
+	def Exit(self):
19
+		print('Exiting')
20 20
 
21 21
 #==================================== 
22
-            
22
+			
23 23
 class Example(State):
24
-    def __init__(self,FSM):
25
-        super(Example, self).__init__(FSM)    
26
-        
27
-    def Enter(self):
28
-        self.FSM.stateLife = 1
29
-        super(Example, self).Enter()        
30
-        
31
-    def Execute(self):
32
-        self.FSM.stateLife += 1
33
-        #self.FSM.ToTransition('toExample')
34
-        
35
-    def Exit(self):
36
-        pass
24
+	def __init__(self,FSM):
25
+		super(Example, self).__init__(FSM)    
26
+		
27
+	def Enter(self):
28
+		self.FSM.stateLife = 1
29
+		super(Example, self).Enter()        
30
+		
31
+	def Execute(self):
32
+		self.FSM.stateLife += 1
33
+		#self.FSM.ToTransition('toExample')
34
+		
35
+	def Exit(self):
36
+		pass
37 37
 
38 38
 #==================================== 
39 39
 
40 40
 class Startup(State):
41
-    def __init__(self,FSM):
42
-        super(Startup, self).__init__(FSM)    
43
-        
44
-    def Enter(self):
45
-        self.FSM.stateLife = 1
46
-        super(Startup, self).Enter()        
47
-        
48
-    def Execute(self):
49
-        self.FSM.stateLife += 1
50
-
51
-        if self.FSM.stateLife == 5:
52
-            self.FSM.ToTransition('toWalk')
53
-        print('player FSM')
54
-        
55
-    def Exit(self):
56
-        pass
41
+	def __init__(self,FSM):
42
+		super(Startup, self).__init__(FSM)    
43
+		
44
+	def Enter(self):
45
+		self.FSM.stateLife = 1
46
+		super(Startup, self).Enter()        
47
+		
48
+	def Execute(self):
49
+		self.FSM.stateLife += 1
50
+
51
+		if self.FSM.stateLife == 5:
52
+			self.FSM.ToTransition('toWalk')
53
+		print('player FSM')
54
+		
55
+	def Exit(self):
56
+		pass
57 57
 
58 58
 #==================================== 
59
-            
59
+			
60 60
 class Walk(State):
61
-    def __init__(self,FSM):
62
-        super(Walk, self).__init__(FSM)    
63
-        
64
-    def Enter(self):
65
-        self.FSM.stateLife = 1
66
-        o = self.FSM.owner.obj
67
-        c = self.FSM.owner
68
-        o['getoffboard'] = False
69
-        o['getonboard'] = False
70
-
71
-        if c.arm == None:
72
-            
73
-            c.arm = o.childrenRecursive['Char4']
74
-            c.deck_arm = o.childrenRecursive['deck_arm']
75
-        self.walk_weight = 1
76
-        self.run_weight = 1
77
-        self.run_speed = 0.0
78
-        self.turn_weight = 0
79
-        self.FSM.owner.walking = True
80
-        dict['walking'] = True
81
-        dict['walk'] = 1
82
-        print('fsm enter walk')
83
-
84
-        super(Walk, self).Enter()        
85
-        
86
-    def Execute(self):
87
-        self.FSM.stateLife += 1
88
-        o = self.FSM.owner.obj
89
-        c = self.FSM.owner
90
-        #print(o.worldPosition.z)
91
-        #print(o['getonboard'], 'dict onboard')
92
-        #print(dict['walk'], 'fsm walk walk')
93
-        # if self.FSM.stateLife == 2:
94
-        #     if o['stance']:
95
-        #         o.applyRotation([0,0,3.14], True)
96
-        #         o['stance'] = False
97
-        #         o['requestAction'] = 'fak_offboard' 
98
-        #         print('request fak offboard')            
99
-        #     else:
100
-        #         o['requestAction'] = 'reg_offboard'                 
101
-        #         print('request reg offboard') 
102
-        # if self.FSM.stateLife > 5:
103
-        #     o['requestAction'] = 'reg_idle'                 
104
-        c.align_walk_z()
105
-        ground_rays = c.get_ground_ray()
106
-        #77777777777777777777777777777777777777777777777777777777777777777777777777777777777
107
-        c.get_hang_align_ray()
108
-        c.move_walk_cam()
109
-        c.check_reset_point()       
110
-        c.check_throw()
111
-
112
-        if ground_rays[0][0] != None:
113
-            dist = c.get_ground_dist(ground_rays)
114
-            if dist > .7:
115
-                self.FSM.ToTransition('toWalkAir')
116
-                #print('---falling')
117
-            else:
118
-                c.set_walk_z(dist)
119
-            #print(dist, 'setting height')
120
-
121
-        if self.FSM.stateLife > 4:
122
-            self.check_onboard()
123
-            self.check_jump()
124
-
125
-            moving = c.walk_movement()
126
-            
127
-            self.get_walk_weight()
128
-            self.idle_blend()
129
-        else:
130
-            dict['walk'] = 1
131
-
132
-
133
-    def check_onboard(self):
134
-
135
-        o = self.FSM.owner.obj
136
-        #print(o['getonboard'], 'getonboard')
137
-
138
-        
139
-        if dict['walk'] == 0:
140
-            o['getonboard'] = True
141
-            #self.FSM.ToTransition('toRoll')
142
-            self.FSM.ToTransition('toWalkOnboard')
143
-            #print('onboard', dict['walk'], o['getonboard'])
144
-        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
145
-        
146
-            
147
-            dropin = self.check_dropin()
148
-            print('-----dropin', dropin)
149
-            if dropin == None:
150
-                o['getonboard'] = True
151
-
152
-                self.FSM.ToTransition('toWalkOnboard')
153
-            else:
154
-                self.FSM.owner.dropin_obj = dropin
155
-                self.FSM.ToTransition('toDropin')
156
-
157
-
158
-
159
-    def check_dropin(self):
160
-        dr = None
161
-        ground_rays = self.FSM.owner.get_dropin_rays()
162
-        for x in ground_rays:
163
-            if x[0] != None:
164
-                #print(x[0], '---checked')
165
-                if 'coping' in x[0]:
166
-                    print('dropin collided')
167
-                    dr = x
168
-        return dr
169
-
170
-    def check_jump(self):
171
-        if dict['xBut'] == True or dict['kb_space'] == 1: 
172
-            if dict['last_xBut'] == 0:
173
-                self.FSM.ToTransition('toWalkJump')
174
-                
175
-
176
-    def idle_blend(self):
177
-        arm = self.FSM.owner.arm
178
-        deck = self.FSM.owner.deck_arm
179
-        arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
180
-        deck.playAction('b_reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
181
-        if self.FSM.stateLife > 20:
182
-            frame = arm.getActionFrame(2) + .5 * self.run_speed
183
-            if frame > 30:
184
-                frame = 0
185
-            arm.stopAction(2)
186
-            deck.stopAction(2)
187
-            arm.playAction('reg_nwalk3', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
188
-            deck.playAction('b_reg_walk', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
189
-            #b_reg_walk
190
-            arm.setActionFrame(frame, 2)
191
-            deck.setActionFrame(frame, 2)
192
-            #print(self.walk_weight, frame)
193
-
194
-            
195
-
196
-            frame = arm.getActionFrame(3) + .5 * self.run_speed
197
-            if frame > 30:
198
-                frame = 0
199
-            arm.stopAction(3)
200
-            deck.stopAction(3)
201
-            arm.playAction('reg_run.003', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
202
-            deck.playAction('b_reg_run', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
203
-            
204
-            arm.setActionFrame(frame, 3)
205
-            deck.setActionFrame(frame, 3)
206
-            #print(frame, 'frame')
207
-            #print(self.run_weight, frame)
208
-            
209
-        # if self.turn_weight > 0:
210
-        #     tw = abs(self.turn_weight - 1)
211
-        #     #tw = self.turn_weight
212
-        #     arm.stopAction(4)
213
-        #     arm.playAction('bwalk_right', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
214
-        # elif self.turn_weight < 0:
215
-        #     tw = abs(abs(self.turn_weight) - 1)
216
-        #     #tw = self.turn_weight
217
-        #     arm.stopAction(4)
218
-        #     arm.playAction('bwalk_left', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
219
-            #print('walk_weight', self.walk_weight)
220
-            if self.walk_weight < .8:
221
-                if frame > 15:
222
-                    if self.FSM.owner.step == False:
223
-                        self.FSM.owner.step = True
224
-                        
225
-                        if frame < 23:
226
-                            print('step left')
227
-                            dict['camera']['sndmgr'].queue_sound(['s_l_1', self.FSM.owner.obj, dict['camera']])
228
-                else:
229
-                    if self.FSM.owner.step == True:
230
-                        self.FSM.owner.step = False
231
-                        if frame < 8:
232
-                            dict['camera']['sndmgr'].queue_sound(['s_r_1', self.FSM.owner.obj, dict['camera']])
233
-                            print('step right')
234
-                    
235
-            # if frame > 15 and self.FSM.owner.step:
236
-            #     self.FSM.owner.step = True
237
-            #     print('step left')
238
-            # if frame < 15 and not self.FSM.owner.step:
239
-            #     self.FSM.owner.step = False
240
-            #     print('step right')
241
-            #print('frame', frame)
242
-
243
-    def get_walk_weight(self):
244
-        #print(self.FSM.owner.linearVelocity.y) 
245
-
246
-
247
-        o = self.FSM.owner.obj
248
-        w = abs(o.linearVelocity.x)
249
-        #wt = 3.5
250
-        #yt = 8
251
-        wt = 1.7
252
-        yt = 3
253
-        out2 = 0
254
-        if w < wt:
255
-            out = w / wt
256
-        else:
257
-            out = 1
258
-            #print('running', w)
259
-            out2 = w / yt
260
-        out = abs(1 - out)
261
-        out2 = abs(1 - out2)
262
-        tgww = round(out, 3)
263
-        tgrw = round(out2, 3)
264
-        incer = .05
265
-        if self.walk_weight < tgww:
266
-            self.walk_weight += incer
267
-        if self.walk_weight > tgww:
268
-            self.walk_weight -= incer
269
-        if self.run_weight <= tgrw:
270
-            self.run_weight += incer
271
-        if self.run_weight > tgrw:
272
-            self.run_weight -= incer
273
-        if self.walk_weight <= 0:
274
-            self.walk_weight = 0
275
-        if self.walk_weight > .95:            
276
-            self.walk_weight = 1        
277
-        if self.run_weight <= 0:
278
-            self.run_weight = 0
279
-        if self.run_weight > .95:
280
-            self.run_weight = 1
281
-
282
-
283
-        if dict['kb_lsh'] == 2 or dict['aBut'] == 1:
284
-            self.run_speed = 1.3
285
-        else:
286
-            self.run_speed = .8
287
-        #print(self.run_speed, '---', self.walk_weight, 'walk weight', self.run_weight, 'run weight')
288
-
289
-    def Exit(self):
290
-        self.FSM.owner.arm.stopAction(0)
291
-        self.FSM.owner.arm.stopAction(1)
292
-        self.FSM.owner.arm.stopAction(2)
293
-        self.FSM.owner.arm.stopAction(3)
294
-        self.FSM.owner.deck_arm.stopAction(0)
295
-        self.FSM.owner.deck_arm.stopAction(1)
296
-        self.FSM.owner.deck_arm.stopAction(2)
297
-        self.FSM.owner.deck_arm.stopAction(3)
298
-        dict['walk'] = 0
61
+	def __init__(self,FSM):
62
+		super(Walk, self).__init__(FSM)    
63
+		
64
+	def Enter(self):
65
+		self.FSM.stateLife = 1
66
+		o = self.FSM.owner.obj
67
+		c = self.FSM.owner
68
+		o['getoffboard'] = False
69
+		o['getonboard'] = False
70
+
71
+		if c.arm == None:
72
+			
73
+			c.arm = o.childrenRecursive['Char4']
74
+			c.deck_arm = o.childrenRecursive['deck_arm']
75
+		self.walk_weight = 1
76
+		self.run_weight = 1
77
+		self.run_speed = 0.0
78
+		self.turn_weight = 0
79
+		self.FSM.owner.walking = True
80
+		dict['walking'] = True
81
+		dict['walk'] = 1
82
+		print('fsm enter walk')
83
+
84
+		super(Walk, self).Enter()        
85
+		
86
+	def Execute(self):
87
+		self.FSM.stateLife += 1
88
+		o = self.FSM.owner.obj
89
+		c = self.FSM.owner
90
+		#print(o.worldPosition.z)
91
+		#print(o['getonboard'], 'dict onboard')
92
+		#print(dict['walk'], 'fsm walk walk')
93
+		# if self.FSM.stateLife == 2:
94
+		#     if o['stance']:
95
+		#         o.applyRotation([0,0,3.14], True)
96
+		#         o['stance'] = False
97
+		#         o['requestAction'] = 'fak_offboard' 
98
+		#         print('request fak offboard')            
99
+		#     else:
100
+		#         o['requestAction'] = 'reg_offboard'                 
101
+		#         print('request reg offboard') 
102
+		# if self.FSM.stateLife > 5:
103
+		#     o['requestAction'] = 'reg_idle'                 
104
+		c.align_walk_z()
105
+		ground_rays = c.get_ground_ray()
106
+		#77777777777777777777777777777777777777777777777777777777777777777777777777777777777
107
+		c.get_hang_align_ray()
108
+		c.move_walk_cam()
109
+		c.check_reset_point()       
110
+		c.check_throw()
111
+		c.check_pause()
112
+		c.check_idle(False)
113
+		c.idle_anim()
114
+
115
+		if ground_rays[0][0] != None:
116
+			dist = c.get_ground_dist(ground_rays)
117
+			if dist > .7:
118
+				self.FSM.ToTransition('toWalkAir')
119
+				#print('---falling')
120
+			else:
121
+				c.set_walk_z(dist)
122
+			#print(dist, 'setting height')
123
+
124
+		if self.FSM.stateLife > 4:
125
+			self.check_onboard()
126
+			self.check_jump()
127
+
128
+			moving = c.walk_movement()
129
+			
130
+			self.get_walk_weight()
131
+			self.idle_blend()
132
+		else:
133
+			dict['walk'] = 1
134
+
135
+
136
+	def check_onboard(self):
137
+
138
+		o = self.FSM.owner.obj
139
+		#print(o['getonboard'], 'getonboard')
140
+
141
+		
142
+		if dict['walk'] == 0:
143
+			o['getonboard'] = True
144
+			#self.FSM.ToTransition('toRoll')
145
+			self.FSM.ToTransition('toWalkOnboard')
146
+			#print('onboard', dict['walk'], o['getonboard'])
147
+		if dict['yBut'] == 1 and dict['last_yBut'] == 0:
148
+		
149
+			
150
+			dropin = self.check_dropin()
151
+			print('-----dropin', dropin)
152
+			if dropin == None:
153
+				o['getonboard'] = True
154
+
155
+				self.FSM.ToTransition('toWalkOnboard')
156
+			else:
157
+				self.FSM.owner.dropin_obj = dropin
158
+				self.FSM.ToTransition('toDropin')
159
+
160
+
161
+
162
+	def check_dropin(self):
163
+		dr = None
164
+		ground_rays = self.FSM.owner.get_dropin_rays()
165
+		for x in ground_rays:
166
+			if x[0] != None:
167
+				#print(x[0], '---checked')
168
+				if 'coping' in x[0]:
169
+					print('dropin collided')
170
+					dr = x
171
+		return dr
172
+
173
+	def check_jump(self):
174
+		if dict['xBut'] == True or dict['kb_space'] == 1: 
175
+			if dict['last_xBut'] == 0:
176
+				self.FSM.ToTransition('toWalkJump')
177
+				
178
+
179
+	def idle_blend(self):
180
+		arm = self.FSM.owner.arm
181
+		deck = self.FSM.owner.deck_arm
182
+		arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=.5, blendin=10)
183
+		deck.playAction('b_reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=10)
184
+		if self.FSM.stateLife > 20:
185
+			frame = arm.getActionFrame(2) + .5 * self.run_speed
186
+			if frame > 30:
187
+				frame = 0
188
+			arm.stopAction(2)
189
+			deck.stopAction(2)
190
+			arm.playAction('reg_nwalk3', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
191
+			deck.playAction('b_reg_walk', 0,30, layer=2, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.walk_weight)
192
+			#b_reg_walk
193
+			arm.setActionFrame(frame, 2)
194
+			deck.setActionFrame(frame, 2)
195
+			#print(self.walk_weight, frame)
196
+
197
+			
198
+
199
+			frame = arm.getActionFrame(3) + .5 * self.run_speed
200
+			if frame > 30:
201
+				frame = 0
202
+			arm.stopAction(3)
203
+			deck.stopAction(3)
204
+			arm.playAction('reg_run.003', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
205
+			deck.playAction('b_reg_run', 0,30, layer=3, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=self.run_weight)
206
+			
207
+			arm.setActionFrame(frame, 3)
208
+			deck.setActionFrame(frame, 3)
209
+			#print(frame, 'frame')
210
+			#print(self.run_weight, frame)
211
+			
212
+		# if self.turn_weight > 0:
213
+		#     tw = abs(self.turn_weight - 1)
214
+		#     #tw = self.turn_weight
215
+		#     arm.stopAction(4)
216
+		#     arm.playAction('bwalk_right', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
217
+		# elif self.turn_weight < 0:
218
+		#     tw = abs(abs(self.turn_weight) - 1)
219
+		#     #tw = self.turn_weight
220
+		#     arm.stopAction(4)
221
+		#     arm.playAction('bwalk_left', 1,60, layer=4, play_mode=1, speed=self.run_speed, blendin=0, layer_weight=tw)
222
+			#print('walk_weight', self.walk_weight)
223
+			if self.walk_weight < .8:
224
+				if frame > 15:
225
+					if self.FSM.owner.step == False:
226
+						self.FSM.owner.step = True
227
+						
228
+						if frame < 23:
229
+							#print('step left')
230
+							dict['camera']['sndmgr'].queue_sound(['s_l_1', self.FSM.owner.obj, dict['camera']])
231
+				else:
232
+					if self.FSM.owner.step == True:
233
+						self.FSM.owner.step = False
234
+						if frame < 8:
235
+							dict['camera']['sndmgr'].queue_sound(['s_r_1', self.FSM.owner.obj, dict['camera']])
236
+							#print('step right')
237
+					
238
+			# if frame > 15 and self.FSM.owner.step:
239
+			#     self.FSM.owner.step = True
240
+			#     print('step left')
241
+			# if frame < 15 and not self.FSM.owner.step:
242
+			#     self.FSM.owner.step = False
243
+			#     print('step right')
244
+			#print('frame', frame)
245
+
246
+	def get_walk_weight(self):
247
+		#print(self.FSM.owner.linearVelocity.y) 
248
+
249
+
250
+		o = self.FSM.owner.obj
251
+		w = abs(o.linearVelocity.x)
252
+		#wt = 3.5
253
+		#yt = 8
254
+		wt = 1.7
255
+		yt = 3
256
+		out2 = 0
257
+		if w < wt:
258
+			out = w / wt
259
+		else:
260
+			out = 1
261
+			#print('running', w)
262
+			out2 = w / yt
263
+		out = abs(1 - out)
264
+		out2 = abs(1 - out2)
265
+		tgww = round(out, 3)
266
+		tgrw = round(out2, 3)
267
+		incer = .05
268
+		if self.walk_weight < tgww:
269
+			self.walk_weight += incer
270
+		if self.walk_weight > tgww:
271
+			self.walk_weight -= incer
272
+		if self.run_weight <= tgrw:
273
+			self.run_weight += incer
274
+		if self.run_weight > tgrw:
275
+			self.run_weight -= incer
276
+		if self.walk_weight <= 0:
277
+			self.walk_weight = 0
278
+		if self.walk_weight > .95:            
279
+			self.walk_weight = 1        
280
+		if self.run_weight <= 0:
281
+			self.run_weight = 0
282
+		if self.run_weight > .95:
283
+			self.run_weight = 1
284
+
285
+
286
+		if dict['kb_lsh'] == 2 or dict['aBut'] == 1:
287
+			self.run_speed = 1.3
288
+		else:
289
+			self.run_speed = .8
290
+		#print(self.run_speed, '---', self.walk_weight, 'walk weight', self.run_weight, 'run weight')
291
+
292
+	def Exit(self):
293
+		self.FSM.owner.arm.stopAction(0)
294
+		self.FSM.owner.arm.stopAction(1)
295
+		self.FSM.owner.arm.stopAction(2)
296
+		self.FSM.owner.arm.stopAction(3)
297
+		self.FSM.owner.deck_arm.stopAction(0)
298
+		self.FSM.owner.deck_arm.stopAction(1)
299
+		self.FSM.owner.deck_arm.stopAction(2)
300
+		self.FSM.owner.deck_arm.stopAction(3)
301
+		dict['walk'] = 0
299 302
 
300 303
 
301 304
 #==================================== 
302
-            
305
+			
303 306
 class WalkAir(State):
304
-    def __init__(self,FSM):
305
-        super(WalkAir, self).__init__(FSM)    
306
-        
307
-    def Enter(self):
308
-        self.FSM.stateLife = 1
309
-        super(WalkAir, self).Enter()        
310
-        
311
-    def Execute(self):
312
-        self.FSM.stateLife += 1
313
-        self.FSM.owner.check_reset_point()  
314
-        arm = self.FSM.owner.arm
315
-        deck_arm = self.FSM.owner.deck_arm
316
-        #arm.playAction('a_jump_t', 23, 23, layer=3, play_mode=1, speed=1, blendin=5)
317
-        arm.playAction('c_jump_up', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
318
-        deck_arm.playAction('b_walk_jump', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
319
-
320
-        if self.FSM.owner.obj.linearVelocity.z < -10:
321
-            self.FSM.owner.obj.linearVelocity.z = -10
322
-        moving = self.FSM.owner.walk_movement() 
323
-        ground_rays = self.FSM.owner.get_ground_ray() 
324
-
325
-        self.FSM.owner.check_throw()
326
-        self.check_onboard()
327
-        self.FSM.owner.align_walk_z()
328
-        if ground_rays[0][0] != None:
329
-            dist = self.FSM.owner.get_ground_dist(ground_rays)
330
-            if dist < .4:
331
-                    self.FSM.ToTransition('toWalkLand')  
332
-
333
-
334
-
335
-            if dist > .5 and self.FSM.owner.obj.worldPosition.z < self.FSM.owner.last_pos.z: 
336
-                hang_ray = self.FSM.owner.get_hang_ray()           
337
-                hang_align_ray = self.FSM.owner.get_hang_align_ray()
338
-
339
-                if hang_ray[0] != None and hang_align_ray[0] != None and self.FSM.prevState != 'WalkHang' and dict['lUD'] < .04:
340
-                    hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
341
-                    if hr_dist < .1:
342
-                        self.FSM.owner.obj.linearVelocity = [0,0,0]
343
-                        self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
344
-                        self.FSM.ToTransition('toWalkHang')
345
-        
346
-    def check_onboard(self):
347
-        o = self.FSM.owner.obj
348
-        # if dict['walk'] == 0:
349
-        #     o['getonboard'] = True
350
-        #     self.FSM.ToTransition('toWalkOnboard')
351
-        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
352
-            o['getonboard'] = True
353
-            #self.FSM.ToTransition('toWalkOnboard')
354
-            self.FSM.ToTransition('toAirOnboard')
355
-
356
-    def Exit(self):
357
-        self.FSM.owner.arm.stopAction(0)
358
-        self.FSM.owner.arm.stopAction(1)
359
-        self.FSM.owner.arm.stopAction(2)
360
-        self.FSM.owner.arm.stopAction(3)
361
-        self.FSM.owner.deck_arm.stopAction(0)
362
-        self.FSM.owner.deck_arm.stopAction(1)
363
-        self.FSM.owner.deck_arm.stopAction(2)
364
-        self.FSM.owner.deck_arm.stopAction(3)
307
+	def __init__(self,FSM):
308
+		super(WalkAir, self).__init__(FSM)    
309
+		
310
+	def Enter(self):
311
+		self.FSM.stateLife = 1
312
+		super(WalkAir, self).Enter()        
313
+		
314
+	def Execute(self):
315
+		self.FSM.stateLife += 1
316
+		self.FSM.owner.check_reset_point()  
317
+		arm = self.FSM.owner.arm
318
+		deck_arm = self.FSM.owner.deck_arm
319
+		#arm.playAction('a_jump_t', 23, 23, layer=3, play_mode=1, speed=1, blendin=5)
320
+		arm.playAction('c_jump_up', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
321
+		deck_arm.playAction('b_walk_jump', 23, 23, layer=3, play_mode=1, speed=1, blendin=15)
322
+
323
+		if self.FSM.owner.obj.linearVelocity.z < -10:
324
+			self.FSM.owner.obj.linearVelocity.z = -10
325
+		moving = self.FSM.owner.walk_movement() 
326
+		ground_rays = self.FSM.owner.get_ground_ray() 
327
+
328
+		self.FSM.owner.check_throw()
329
+		self.check_onboard()
330
+		self.FSM.owner.align_walk_z()
331
+		self.FSM.owner.check_pause()
332
+		if ground_rays[0][0] != None:
333
+			dist = self.FSM.owner.get_ground_dist(ground_rays)
334
+			if dist < .4:
335
+					self.FSM.ToTransition('toWalkLand')  
336
+
337
+
338
+
339
+			if dist > .5 and self.FSM.owner.obj.worldPosition.z < self.FSM.owner.last_pos.z: 
340
+				hang_ray = self.FSM.owner.get_hang_ray()           
341
+				hang_align_ray = self.FSM.owner.get_hang_align_ray()
342
+
343
+				if hang_ray[0] != None and hang_align_ray[0] != None and self.FSM.prevState != 'WalkHang' and dict['lUD'] < .04:
344
+					hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
345
+					if hr_dist < .1:
346
+						self.FSM.owner.obj.linearVelocity = [0,0,0]
347
+						self.FSM.owner.obj.worldPosition.z = hang_ray[1].z - 1
348
+						self.FSM.ToTransition('toWalkHang')
349
+		
350
+	def check_onboard(self):
351
+		o = self.FSM.owner.obj
352
+		# if dict['walk'] == 0:
353
+		#     o['getonboard'] = True
354
+		#     self.FSM.ToTransition('toWalkOnboard')
355
+		if dict['yBut'] == 1 and dict['last_yBut'] == 0:
356
+			o['getonboard'] = True
357
+			#self.FSM.ToTransition('toWalkOnboard')
358
+			self.FSM.ToTransition('toAirOnboard')
359
+
360
+	def Exit(self):
361
+		self.FSM.owner.arm.stopAction(0)
362
+		self.FSM.owner.arm.stopAction(1)
363
+		self.FSM.owner.arm.stopAction(2)
364
+		self.FSM.owner.arm.stopAction(3)
365
+		self.FSM.owner.deck_arm.stopAction(0)
366
+		self.FSM.owner.deck_arm.stopAction(1)
367
+		self.FSM.owner.deck_arm.stopAction(2)
368
+		self.FSM.owner.deck_arm.stopAction(3)
365 369
 
366 370
 #==================================== 
367
-            
371
+			
368 372
 class WalkJump(State):
369
-    def __init__(self,FSM):
370
-        super(WalkJump, self).__init__(FSM)    
371
-        
372
-    def Enter(self):
373
-        self.FSM.stateLife = 1
374
-        dict['camera']['sndmgr'].queue_sound(['walk_grunt', self.FSM.owner.obj, dict['camera']])
375
-        arm = self.FSM.owner.arm
376
-        deck = self.FSM.owner.deck_arm
377
-        #arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
378
-        arm.playAction('c_jump_up', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
379
-        deck.playAction('b_walk_jump', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
380
-            
381
-
382
-        super(WalkJump, self).Enter()        
383
-        
384
-    def Execute(self):
385
-        self.FSM.stateLife += 1
386
-        arm = self.FSM.owner.arm
387
-        o = self.FSM.owner.obj
388
-
389
-        moving = self.FSM.owner.walk_movement()              
390
-        self.check_onboard()
391
-        if self.FSM.stateLife == 10:
392
-                force = [ 0.0, 0.0, dict['walk_jump_force']]
393
-                if o.linearVelocity.z < 10:
394
-                     o.applyForce(force, True)
395
-
396
-        if self.FSM.stateLife > 27:
397
-            self.FSM.ToTransition('toWalkAir')
398
-
399
-    def check_onboard(self):
400
-        o = self.FSM.owner.obj
401
-        # if dict['walk'] == 0:
402
-        #     o['getonboard'] = True
403
-        #     self.FSM.ToTransition('toWalkOnboard')
404
-        if dict['yBut'] == 1 and dict['last_yBut'] == 0:
405
-            o['getonboard'] = True
406
-            self.FSM.ToTransition('toAirOnboard')            
407
-        
408
-    def Exit(self):
409
-        pass
373
+	def __init__(self,FSM):
374
+		super(WalkJump, self).__init__(FSM)    
375
+		
376
+	def Enter(self):
377
+		self.FSM.stateLife = 1
378
+		dict['camera']['sndmgr'].queue_sound(['walk_grunt', self.FSM.owner.obj, dict['camera']])
379
+		arm = self.FSM.owner.arm
380
+		deck = self.FSM.owner.deck_arm
381
+		#arm.playAction('a_jump_t', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
382
+		arm.playAction('c_jump_up', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
383
+		deck.playAction('b_walk_jump', 1, 23, layer=3, play_mode=0, speed=1, blendin=5)
384
+			
385
+
386
+		super(WalkJump, self).Enter()        
387
+		
388
+	def Execute(self):
389
+		self.FSM.stateLife += 1
390
+		arm = self.FSM.owner.arm
391
+		o = self.FSM.owner.obj
392
+
393
+		moving = self.FSM.owner.walk_movement()              
394
+		self.check_onboard()
395
+		self.FSM.owner.check_pause()
396
+		if self.FSM.stateLife == 10:
397
+				force = [ 0.0, 0.0, dict['walk_jump_force']]
398
+				if o.linearVelocity.z < 10:
399
+					 o.applyForce(force, True)
400
+
401
+		if self.FSM.stateLife > 27:
402
+			self.FSM.ToTransition('toWalkAir')
403
+
404
+	def check_onboard(self):
405
+		o = self.FSM.owner.obj
406
+		# if dict['walk'] == 0:
407
+		#     o['getonboard'] = True
408
+		#     self.FSM.ToTransition('toWalkOnboard')
409
+		if dict['yBut'] == 1 and dict['last_yBut'] == 0:
410
+			o['getonboard'] = True
411
+			self.FSM.ToTransition('toAirOnboard')            
412
+		
413
+	def Exit(self):
414
+		pass
410 415
 
411 416
 #==================================== 
412
-            
417
+			
413 418
 class WalkLand(State):
414
-    def __init__(self,FSM):
415
-        super(WalkLand, self).__init__(FSM)    
416
-        
417
-    def Enter(self):
418
-        self.FSM.stateLife = 1
419
-        #self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
420
-        self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
421
-        self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
422
-        dict['camera']['sndmgr'].queue_sound(['walk_land', self.FSM.owner.obj, dict['camera']])
423
-        #c_land
424
-        super(WalkLand, self).Enter()        
425
-        
426
-    def Execute(self):
427
-        self.FSM.stateLife += 1
428
-        self.FSM.owner.obj.linearVelocity.x *= .8
429
-        self.FSM.owner.obj.linearVelocity.y *= .8
430
-        # arm = self.FSM.owner.arm
431
-        
432
-        # print('af', arm.getActionFrame(5))
433
-        # if arm.getActionFrame(5) > 30:
434
-        #     print('stopping land')
435
-        #     arm.stopAction(5)
436
-        #     arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=2)
437
-        if self.FSM.stateLife > 30:
438
-            self.FSM.ToTransition('toWalk')
439
-
440
-        ground_rays = self.FSM.owner.get_ground_ray() 
441
-        if ground_rays[0][0] != None:
442
-            dist = self.FSM.owner.get_ground_dist(ground_rays)
443
-            self.FSM.owner.set_walk_z(dist)
444
-
445
-    def Exit(self):
446
-        pass
419
+	def __init__(self,FSM):
420
+		super(WalkLand, self).__init__(FSM)    
421
+		
422
+	def Enter(self):
423
+		self.FSM.stateLife = 1
424
+		#self.FSM.owner.arm.playAction('a_jump_t', 23, 50, layer=5, play_mode=0, speed=1, blendin=5)
425
+		self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
426
+		self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
427
+		dict['camera']['sndmgr'].queue_sound(['walk_land', self.FSM.owner.obj, dict['camera']])
428
+		#c_land
429
+		super(WalkLand, self).Enter()        
430
+		
431
+	def Execute(self):
432
+		self.FSM.stateLife += 1
433
+		self.FSM.owner.obj.linearVelocity.x *= .8
434
+		self.FSM.owner.obj.linearVelocity.y *= .8
435
+		# arm = self.FSM.owner.arm
436
+		
437
+		# print('af', arm.getActionFrame(5))
438
+		# if arm.getActionFrame(5) > 30:
439
+		#     print('stopping land')
440
+		#     arm.stopAction(5)
441
+		#     arm.playAction('reg_idle1', 1,120, layer=1, play_mode=1, speed=1, blendin=2)
442
+		if self.FSM.stateLife > 30:
443
+			self.FSM.ToTransition('toWalk')
444
+
445
+		self.FSM.owner.check_pause()
446
+		ground_rays = self.FSM.owner.get_ground_ray() 
447
+		if ground_rays[0][0] != None:
448
+			dist = self.FSM.owner.get_ground_dist(ground_rays)
449
+			self.FSM.owner.set_walk_z(dist)
450
+
451
+	def Exit(self):
452
+		pass
447 453
 
448 454
 #==================================== 
449
-            
455
+			
450 456
 class WalkHang(State):
451
-    def __init__(self,FSM):
452
-        super(WalkHang, self).__init__(FSM)    
453
-        
454
-    def Enter(self):
455
-        self.FSM.stateLife = 1
456
-        self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
457
-        self.moveable = False
458
-        dict['camera']['sndmgr'].queue_sound(['walk_hang', self.FSM.owner.obj, dict['camera']])
459
-        self.FSM.owner.drop_deck()
460
-        #self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
461
-        super(WalkHang, self).Enter()        
462
-        
463
-    def Execute(self):
464
-        self.FSM.stateLife += 1
465
-        self.FSM.owner.obj.linearVelocity = [0,0,0]
466
-        #self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
467
-        self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
468
-        if dict['lUD'] > .04:
469
-            self.FSM.ToTransition('toWalkAir')
470
-           
471
-        
472
-        self.FSM.owner.move_walk_cam()
473
-        if self.FSM.stateLife > 25:
474
-            self.moveable = True
475
-        if self.moveable:
476
-            if dict['lUD'] < -.04:
477
-                self.FSM.ToTransition('toWalkClimb') 
478
-            self.FSM.owner.hang_move()
479
-        ground_rays = self.FSM.owner.get_ground_ray() 
480
-        if ground_rays[0][0] != None:
481
-            dist = self.FSM.owner.get_ground_dist(ground_rays)
482
-            if dist < .4:
483
-                self.FSM.ToTransition('toWalkLand') 
484
-
485
-        hang_ray = self.FSM.owner.get_hang_ray()           
486
-        hang_align_ray = self.FSM.owner.get_hang_align_ray()
487
-        #print(hang_align_ray, 'hang_align_ray')
488
-        #self.FSM.owner.hang_move()
489
-
490
-
491
-
492
-        if hang_ray[0] != None:
493
-            hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
494
-            #print(hr_dist, 'hang dist')
495
-            if hr_dist < .5:
496
-                self.FSM.owner.obj.linearVelocity = [0,0,0]
497
-                self.FSM.owner.obj.worldPosition.z = hang_ray[1].z  - 1
498
-            if hang_align_ray[0] != None:
499
-                #print(hang_align_ray[0])
500
-                v = hang_align_ray[2]
501
-                self.FSM.owner.obj.alignAxisToVect(v, 0, .5)    
502
-        else:
503
-            self.FSM.ToTransition('toWalkAir')
504
-        if hang_align_ray[0] == None:
505
-            self.FSM.ToTransition('toWalkAir')
506
-
507
-        self.FSM.owner.align_walk_z()
508
-    def Exit(self):
509
-        pass
457
+	def __init__(self,FSM):
458
+		super(WalkHang, self).__init__(FSM)    
459
+		
460
+	def Enter(self):
461
+		self.FSM.stateLife = 1
462
+		self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
463
+		self.moveable = False
464
+		dict['camera']['sndmgr'].queue_sound(['walk_hang', self.FSM.owner.obj, dict['camera']])
465
+		self.FSM.owner.drop_deck()
466
+		#self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
467
+		super(WalkHang, self).Enter()        
468
+		
469
+	def Execute(self):
470
+		self.FSM.stateLife += 1
471
+		self.FSM.owner.obj.linearVelocity = [0,0,0]
472
+		#self.FSM.owner.arm.playAction('c_braced_hang', 0, 36, layer=2, play_mode=0, speed=1, blendin=10)
473
+		self.FSM.owner.arm.playAction('c_braced_hang', 36, 50, layer=1, play_mode=1, speed=1, blendin=10)
474
+		if dict['lUD'] > .04:
475
+			self.FSM.ToTransition('toWalkAir')
476
+		   
477
+		
478
+		self.FSM.owner.move_walk_cam()
479
+		self.FSM.owner.check_pause()
480
+		if self.FSM.stateLife > 25:
481
+			self.moveable = True
482
+		if self.moveable:
483
+			if dict['lUD'] < -.04:
484
+				self.FSM.ToTransition('toWalkClimb') 
485
+			self.FSM.owner.hang_move()
486
+		ground_rays = self.FSM.owner.get_ground_ray() 
487
+		if ground_rays[0][0] != None:
488
+			dist = self.FSM.owner.get_ground_dist(ground_rays)
489
+			if dist < .4:
490
+				self.FSM.ToTransition('toWalkLand') 
491
+
492
+		hang_ray = self.FSM.owner.get_hang_ray()           
493
+		hang_align_ray = self.FSM.owner.get_hang_align_ray()
494
+		#print(hang_align_ray, 'hang_align_ray')
495
+		#self.FSM.owner.hang_move()
496
+
497
+
498
+
499
+		if hang_ray[0] != None:
500
+			hr_dist = self.FSM.owner.get_hang_dist(hang_ray)
501
+			#print(hr_dist, 'hang dist')
502
+			if hr_dist < .5:
503
+				self.FSM.owner.obj.linearVelocity = [0,0,0]
504
+				self.FSM.owner.obj.worldPosition.z = hang_ray[1].z  - 1
505
+			if hang_align_ray[0] != None:
506
+				#print(hang_align_ray[0])
507
+				v = hang_align_ray[2]
508
+				self.FSM.owner.obj.alignAxisToVect(v, 0, .5)    
509
+		else:
510
+			self.FSM.ToTransition('toWalkAir')
511
+		if hang_align_ray[0] == None:
512
+			self.FSM.ToTransition('toWalkAir')
513
+
514
+		self.FSM.owner.align_walk_z()
515
+	def Exit(self):
516
+		pass
510 517
 
511 518
 #==================================== 
512
-            
519
+			
513 520
 class WalkClimb(State):
514
-    def __init__(self,FSM):
515
-        super(WalkClimb, self).__init__(FSM)    
516
-        
517
-    def Enter(self):
518
-        self.FSM.stateLife = 1
519
-        self.FSM.owner.arm.playAction('c_wallclimb', 1, 50, layer=3, play_mode=0, speed=1, blendin=10)
520
-        dict['camera']['sndmgr'].queue_sound(['walk_climb', self.FSM.owner.obj, dict['camera']])
521
-        super(WalkClimb, self).Enter()        
522
-        
523
-    def Execute(self):
524
-        self.FSM.stateLife += 1
525
-        #self.FSM.ToTransition('toLand')
526
-        
527
-        if self.FSM.stateLife > 25:
528
-            self.FSM.owner.obj.applyForce([-300, 0, 80], True)
529
-        else:
530
-            self.FSM.owner.obj.applyForce([-20, 0, 80], True)    
531
-        if self.FSM.stateLife > 35:
532
-            self.FSM.ToTransition('toWalkLand')
533
-        
534
-    def Exit(self):
535
-        pass                                
521
+	def __init__(self,FSM):
522
+		super(WalkClimb, self).__init__(FSM)    
523
+		
524
+	def Enter(self):
525
+		self.FSM.stateLife = 1
526
+		self.FSM.owner.arm.playAction('c_wallclimb', 1, 50, layer=3, play_mode=0, speed=1, blendin=10)
527
+		dict['camera']['sndmgr'].queue_sound(['walk_climb', self.FSM.owner.obj, dict['camera']])
528
+		super(WalkClimb, self).Enter()        
529
+		
530
+	def Execute(self):
531
+		self.FSM.stateLife += 1
532
+		#self.FSM.ToTransition('toLand')
533
+		self.FSM.owner.check_pause()
534
+		if self.FSM.stateLife > 25:
535
+			self.FSM.owner.obj.applyForce([-300, 0, 80], True)
536
+		else:
537
+			self.FSM.owner.obj.applyForce([-20, 0, 80], True)    
538
+		if self.FSM.stateLife > 35:
539
+			self.FSM.ToTransition('toWalkLand')
540
+		
541
+	def Exit(self):
542
+		pass                                
536 543
 
537 544
 #==================================== 
538
-            
545
+			
539 546
 class WalkHurdle(State):
540
-    def __init__(self,FSM):
541
-        super(WalkHurdle, self).__init__(FSM)    
542
-        
543
-    def Enter(self):
544
-        self.FSM.stateLife = 1
545
-        super(WalkHurdle, self).Enter()        
546
-        
547
-    def Execute(self):
548
-        self.FSM.stateLife += 1
549
-        #self.FSM.ToTransition('toLand')
550
-        
551
-    def Exit(self):
552
-        pass                                
547
+	def __init__(self,FSM):
548
+		super(WalkHurdle, self).__init__(FSM)    
549
+		
550
+	def Enter(self):
551
+		self.FSM.stateLife = 1
552
+		super(WalkHurdle, self).Enter()        
553
+		
554
+	def Execute(self):
555
+		self.FSM.stateLife += 1
556
+		#self.FSM.ToTransition('toLand')
557
+		
558
+	def Exit(self):
559
+		pass                                
553 560
 
554 561
 
555 562
 #==================================== 
556 563
 
557
-            
564
+			
558 565
 class WalkOnboard(State):
559
-    def __init__(self,FSM):
560
-        super(WalkOnboard, self).__init__(FSM)    
561
-        
562
-    def Enter(self):
563
-        self.FSM.stateLife = 1
564
-        self.FSM.owner.walking = False
565
-        self.FSM.owner.obj['getonboard'] = False
566
-        if self.FSM.owner.throw_deck != None:
567
-            self.FSM.owner.throw_deck.endObject()
568
-            self.FSM.owner.throw_deck = None
569
-            self.FSM.owner.show_deck()
570
-        dict['walking'] = False
571
-        self.FSM.owner.obj['walking'] = False
572
-        self.FSM.owner.obj['requestAction'] = 'reg_onboard'
573
-        self.FSM.owner.obj['getoffboard'] == False
574
-        self.FSM.owner.obj.applyForce([-300, 0, 0], True)
575
-        print('walkonboard entered')
576
-        super(WalkOnboard, self).Enter()        
577
-        
578
-    def Execute(self):
579
-        self.FSM.stateLife += 1
580
-        self.FSM.ToTransition('toRoll')
581
-        
582
-    def Exit(self):
583
-        pass
566
+	def __init__(self,FSM):
567
+		super(WalkOnboard, self).__init__(FSM)    
568
+		
569
+	def Enter(self):
570
+		self.FSM.stateLife = 1
571
+		self.FSM.owner.walking = False
572
+		self.FSM.owner.obj['getonboard'] = False
573
+		if self.FSM.owner.throw_deck != None:
574
+			self.FSM.owner.throw_deck.endObject()
575
+			self.FSM.owner.throw_deck = None
576
+			self.FSM.owner.show_deck()
577
+		dict['walking'] = False
578
+		self.FSM.owner.obj['walking'] = False
579
+		self.FSM.owner.obj['requestAction'] = 'reg_onboard'
580
+		self.FSM.owner.obj['getoffboard'] == False
581
+		self.FSM.owner.obj.applyForce([-300, 0, 0], True)
582
+		print('walkonboard entered')
583
+		super(WalkOnboard, self).Enter()        
584
+		
585
+	def Execute(self):
586
+		self.FSM.stateLife += 1
587
+		self.FSM.ToTransition('toRoll')
588
+		
589
+	def Exit(self):
590
+		pass
584 591
 
585 592
 #==================================== 
586 593
 
587 594
 
588
-            
595
+			
589 596
 class AirOnboard(State):
590
-    def __init__(self,FSM):
591
-        super(AirOnboard, self).__init__(FSM)    
592
-        
593
-    def Enter(self):
594
-        self.FSM.stateLife = 1
595
-        self.FSM.owner.walking = False
596
-        self.FSM.owner.obj['getonboard'] = False
597
-        if self.FSM.owner.throw_deck != None:
598
-            self.FSM.owner.throw_deck.endObject()
599
-            self.FSM.owner.throw_deck = None
600
-            self.FSM.owner.show_deck()
601
-        dict['walking'] = False
602
-        self.FSM.owner.obj['walking'] = False
603
-        #self.FSM.owner.obj['requestAction'] = 'reg_onboard'
604
-
605
-        self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
606
-        self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
607
-
608
-        self.FSM.owner.obj['getoffboard'] == False
609
-        self.FSM.owner.obj.applyForce([-300, 0, 0], True)
610
-        print('air entered')
611
-        super(AirOnboard, self).Enter()        
612
-        
613
-    def Execute(self):
614
-        self.FSM.stateLife += 1
615
-        print('@@@@@@@@@@@@@@@@@@@@@@@@@@@air ob')
616
-        self.FSM.ToTransition('toRoll')
617
-        
618
-    def Exit(self):
619
-        pass
597
+	def __init__(self,FSM):
598
+		super(AirOnboard, self).__init__(FSM)    
599
+		
600
+	def Enter(self):
601
+		self.FSM.stateLife = 1
602
+		self.FSM.owner.walking = False
603
+		self.FSM.owner.obj['getonboard'] = False
604
+		if self.FSM.owner.throw_deck != None:
605
+			self.FSM.owner.throw_deck.endObject()
606
+			self.FSM.owner.throw_deck = None
607
+			self.FSM.owner.show_deck()
608
+		dict['walking'] = False
609
+		self.FSM.owner.obj['walking'] = False
610
+		#self.FSM.owner.obj['requestAction'] = 'reg_onboard'
611
+
612
+		self.FSM.owner.arm.playAction('c_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
613
+		self.FSM.owner.deck_arm.playAction('b_walk_land', 0, 50, layer=1, play_mode=0, speed=1, blendin=5)
614
+
615
+		self.FSM.owner.obj['getoffboard'] == False
616
+		self.FSM.owner.obj.applyForce([-300, 0, 0], True)
617
+		print('air entered')
618
+		super(AirOnboard, self).Enter()        
619
+		
620
+	def Execute(self):
621
+		self.FSM.stateLife += 1
622
+		self.FSM.ToTransition('toRoll')
623
+		
624
+	def Exit(self):
625
+		pass
620 626
 
621 627
 #==================================== 
622
-            
628
+			
623 629
 class Roll(State):
624
-    def __init__(self,FSM):
625
-        super(Roll, self).__init__(FSM)    
626
-        
627
-    def Enter(self):
628
-        self.FSM.stateLife = 1
629
-        # self.FSM.owner.obj['getoffboard'] == False
630
-        # dict['walk'] = 0
631
-        print('roll entered')
632
-        super(Roll, self).Enter()        
633
-        
634
-    def Execute(self):
635
-        self.FSM.stateLife += 1
636
-        if dict['walk'] == 1 or self.FSM.owner.obj['getoffboard'] == True:
637
-            dict['walk'] = 1
638
-            self.FSM.owner.obj['getoffboard'] = True
639
-            #self.FSM.ToTransition('toWalk')
640
-            self.FSM.ToTransition('toOffboard')
641
-            print('fsm to walk', dict['walk'], self.FSM.owner.obj['getoffboard'])
642
-        if self.FSM.owner.obj['fall'] == True:
643
-            self.FSM.ToTransition('toRagdoll')    
644
-        #print('rolling')
645
-        #self.FSM.ToTransition('toLand')
646
-        
647
-    def Exit(self):
648
-        pass
630
+	def __init__(self,FSM):
631
+		super(Roll, self).__init__(FSM)    
632
+		
633
+	def Enter(self):
634
+		self.FSM.stateLife = 1
635
+		# self.FSM.owner.obj['getoffboard'] == False
636
+		# dict['walk'] = 0
637
+		print('roll entered')
638
+		super(Roll, self).Enter()        
639
+		
640
+	def Execute(self):
641
+		self.FSM.stateLife += 1
642
+		if dict['walk'] == 1 or self.FSM.owner.obj['getoffboard'] == True:
643
+			dict['walk'] = 1
644
+			self.FSM.owner.obj['getoffboard'] = True
645
+			#self.FSM.ToTransition('toWalk')
646
+			self.FSM.ToTransition('toOffboard')
647
+			#print('fsm to walk', dict['walk'], self.FSM.owner.obj['getoffboard'])
648
+		if self.FSM.owner.obj['fall'] == True:
649
+			self.FSM.ToTransition('toRagdoll')    
650
+		#print('rolling')
651
+		#self.FSM.ToTransition('toLand')
652
+		
653
+	def Exit(self):
654
+		pass
649 655
 
650 656
 #==================================== 
651 657
 
652 658
 class Offboard(State):
653
-    def __init__(self,FSM):
654
-        super(Offboard, self).__init__(FSM)    
655
-        
656
-    def Enter(self):
657
-        self.FSM.stateLife = 1
658
-        
659
-        o = self.FSM.owner.obj
660
-        if o['stance']:
661
-            o.applyRotation([0,0,3.14], True)
662
-            o['stance'] = False
663
-            self.FSM.owner.arm.playAction('fak_noffboard', 0,24, layer=2, play_mode=0, speed=1, blendin=0)
664
-            self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,30, layer=2, play_mode=0, speed=1, blendin=0)
665
-        else:
666
-            self.FSM.owner.arm.playAction('reg_noffboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
667
-            self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
668
-        print('fsm getting off board')
669
-        super(Offboard, self).Enter()        
670
-        
671
-    def Execute(self):
672
-        self.FSM.stateLife += 1
673
-        
674
-        self.FSM.ToTransition('toWalk')
675
-        
676
-    def Exit(self):
677
-        pass
659
+	def __init__(self,FSM):
660
+		super(Offboard, self).__init__(FSM)    
661
+		
662
+	def Enter(self):
663
+		self.FSM.stateLife = 1
664
+		
665
+		o = self.FSM.owner.obj
666
+		if o['stance']:
667
+			o.applyRotation([0,0,3.14], True)
668
+			o['stance'] = False
669
+			self.FSM.owner.arm.playAction('fak_noffboard', 0,24, layer=2, play_mode=0, speed=1, blendin=0)
670
+			self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,30, layer=2, play_mode=0, speed=1, blendin=0)
671
+		else:
672
+			self.FSM.owner.arm.playAction('reg_noffboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
673
+			self.FSM.owner.deck_arm.playAction('b_reg_offboard', 0,40, layer=2, play_mode=0, speed=1, blendin=0)
674
+		print('fsm getting off board')
675
+		super(Offboard, self).Enter()        
676
+		
677
+	def Execute(self):
678
+		self.FSM.stateLife += 1
679
+		
680
+		self.FSM.ToTransition('toWalk')
681
+		
682
+	def Exit(self):
683
+		pass
678 684
 #==================================== 
679 685
 
680 686
 class Ragdoll(State):
681
-    def __init__(self,FSM):
682
-        super(Ragdoll, self).__init__(FSM)    
683
-        
684
-    def Enter(self):
685
-        self.FSM.stateLife = 1
686
-        self.FSM.owner.obj['ragdoll_active'] = True
687
-        self.FSM.owner.drop_deck()
688
-        print('ragdoll_player_fsm entered')
689
-        super(Ragdoll, self).Enter()        
690
-        
691
-    def Execute(self):
692
-        self.FSM.stateLife += 1
693
-        print('ragdolling')
694
-        if dict['yBut'] == 1:
695
-            self.FSM.owner.obj['fall'] = False
696
-            self.FSM.owner.cont.activate(self.FSM.owner.cont.actuators['walk'])
697
-            #self.FSM.ToTransition('toWalk')
698
-            self.FSM.ToTransition('toOffboard')
699
-        self.FSM.owner.move_walk_cam()
700
-    def Exit(self):
701
-        print('ragdoll_player_fsm exited')
702
-        self.FSM.owner.obj['ragdoll_active'] = False
703
-        #pass                                
687
+	def __init__(self,FSM):
688
+		super(Ragdoll, self).__init__(FSM)    
689
+		
690
+	def Enter(self):
691
+		self.FSM.stateLife = 1
692
+		self.FSM.owner.obj['ragdoll_active'] = True
693
+		self.FSM.owner.drop_deck()
694
+		print('ragdoll_player_fsm entered')
695
+		super(Ragdoll, self).Enter()        
696
+		
697
+	def Execute(self):
698
+		self.FSM.stateLife += 1
699
+		#print('ragdolling')
700
+		if dict['yBut'] == 1:
701
+			self.FSM.owner.obj['fall'] = False
702
+			self.FSM.owner.cont.activate(self.FSM.owner.cont.actuators['walk'])
703
+			#self.FSM.ToTransition('toWalk')
704
+			self.FSM.ToTransition('toOffboard')
705
+		self.FSM.owner.move_walk_cam()
706
+		self.FSM.owner.check_pause()
707
+	def Exit(self):
708
+		print('ragdoll_player_fsm exited')
709
+		self.FSM.owner.obj['ragdoll_active'] = False
710
+		#pass                                
704 711
 
705 712
 #==================================== 
706
-            
713
+			
707 714
 class Dropin(State):
708
-    def __init__(self,FSM):
709
-        super(Dropin, self).__init__(FSM)    
710
-        
711
-    def Enter(self):
712
-        self.FSM.stateLife = 1
713
-        if self.FSM.owner.throw_deck != None:
714
-            self.FSM.owner.throw_deck.endObject()
715
-            self.FSM.owner.throw_deck = None
716
-            self.FSM.owner.show_deck()
717
-        self.FSM.owner.arm.playAction('reg_dropin3', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
718
-        self.FSM.owner.deck_arm.playAction('b_reg_dropin', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
719
-        self.out_triggered = False
720
-        # #player armature action name, start, end frames
721
-        # 'reg_dropin3', 30, 50,
722
-        # #deck action name, start, end frames  
723
-        # 'b_reg_dropin', 30, 50,
724
-        # #layer, speed, mode (0 = play, 1 = loop), blendin
725
-        # 1, .5, 0, 15,
726
-        # #intro, length
727
-
728
-        super(Dropin, self).Enter()        
729
-        
730
-    def Execute(self):
731
-        self.FSM.stateLife += 1
732
-        print('dropin')
733
-        eu = self.FSM.owner.get_vert_rot(self.FSM.owner.obj, self.FSM.owner.dropin_obj[0])
734
-        #print(eu, 'eu')
735
-        
736
-        self.FSM.owner.arm.playAction('reg_dropin3', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
737
-        self.FSM.owner.deck_arm.playAction('b_reg_dropin', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
738
-        
739
-        if dict['last_yBut'] == True and dict['yBut'] == False:
740
-            self.out_triggered = True
741
-        
742
-        if self.out_triggered:
743
-            self.FSM.owner.arm.playAction('reg_dropin3', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
744
-            self.FSM.owner.deck_arm.playAction('b_reg_dropin', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
745
-            self.FSM.owner.obj.applyForce([-15, 0, 0], True)
746
-            self.FSM.owner.obj.applyRotation([0, -.01, 0], True)
747
-
748
-        else:
749
-            self.FSM.owner.move_to_te()
750
-
751
-        if self.FSM.owner.arm.getActionFrame(2)> 78:
752
-            
753
-            self.FSM.ToTransition('toRoll')
754
-
755
-        self.FSM.owner.move_walk_cam()
756
-
757
-        
758
-        
759
-
760
-
761
-    def Exit(self):
762
-        self.FSM.owner.obj['getonboard'] = True
763
-        self.FSM.owner.walking = False
764
-        #self.FSM.owner.obj['getonboard'] = False
765
-        dict['walking'] = False
766
-        self.FSM.owner.obj['walking'] = False
767
-        self.FSM.owner.obj['requestAction'] = 'reg_air'
768
-        self.FSM.owner.obj['getoffboard'] == False
715
+	def __init__(self,FSM):
716
+		super(Dropin, self).__init__(FSM)    
717
+		
718
+	def Enter(self):
719
+		self.FSM.stateLife = 1
720
+		if self.FSM.owner.throw_deck != None:
721
+			self.FSM.owner.throw_deck.endObject()
722
+			self.FSM.owner.throw_deck = None
723
+			self.FSM.owner.show_deck()
724
+		self.FSM.owner.arm.playAction('reg_dropin3', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
725
+		self.FSM.owner.deck_arm.playAction('b_reg_dropin', 30, 50, layer=2, play_mode=0, speed=1, blendin=5)
726
+		self.out_triggered = False
727
+		# #player armature action name, start, end frames
728
+		# 'reg_dropin3', 30, 50,
729
+		# #deck action name, start, end frames  
730
+		# 'b_reg_dropin', 30, 50,
731
+		# #layer, speed, mode (0 = play, 1 = loop), blendin
732
+		# 1, .5, 0, 15,
733
+		# #intro, length
734
+
735
+		super(Dropin, self).Enter()        
736
+		
737
+	def Execute(self):
738
+		self.FSM.stateLife += 1
739
+		#print('dropin')
740
+		eu = self.FSM.owner.get_vert_rot(self.FSM.owner.obj, self.FSM.owner.dropin_obj[0])
741
+		#print(eu, 'eu')
742
+		
743
+		self.FSM.owner.arm.playAction('reg_dropin3', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
744
+		self.FSM.owner.deck_arm.playAction('b_reg_dropin', 50, 50, layer=1, play_mode=1, speed=1, blendin=5)
745
+		
746
+		if dict['last_yBut'] == True and dict['yBut'] == False:
747
+			self.out_triggered = True
748
+		
749
+		if self.out_triggered:
750
+			self.FSM.owner.arm.playAction('reg_dropin3', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
751
+			self.FSM.owner.deck_arm.playAction('b_reg_dropin', 60, 80, layer=2, play_mode=0, speed=1, blendin=5)
752
+			self.FSM.owner.obj.applyForce([-15, 0, 0], True)
753
+			self.FSM.owner.obj.applyRotation([0, -.01, 0], True)
754
+
755
+		else:
756
+			self.FSM.owner.move_to_te()
757
+
758
+		if self.FSM.owner.arm.getActionFrame(2)> 78:
759
+			
760
+			self.FSM.ToTransition('toRoll')
761
+
762
+		self.FSM.owner.move_walk_cam()
763
+		self.FSM.owner.check_pause()
764
+
765
+		
766
+		
767
+
768
+
769
+	def Exit(self):
770
+		self.FSM.owner.obj['getonboard'] = True
771
+		self.FSM.owner.walking = False
772
+		#self.FSM.owner.obj['getonboard'] = False
773
+		dict['walking'] = False
774
+		self.FSM.owner.obj['walking'] = False
775
+		self.FSM.owner.obj['requestAction'] = 'reg_air'
776
+		self.FSM.owner.obj['getoffboard'] == False
769 777
 
770 778
 
771 779
 
772 780
 #==================================== 
781
+
782
+#==================================== 
783
+			
784
+class Pause(State):
785
+	def __init__(self,FSM):
786
+		super(Pause, self).__init__(FSM)    
787
+		
788
+	def Enter(self):
789
+		self.FSM.stateLife = 1
790
+		super(Pause, self).Enter()        
791
+		
792
+	def Execute(self):
793
+		self.FSM.stateLife += 1
794
+		#print('******paused')
795
+		self.FSM.owner.obj['walk'] = True
796
+		if dict['npause'] == False:
797
+			n = self.FSM.prevState.__class__.__name__
798
+			n = 'to' + n
799
+			#self.FSM.ToTransition('toWalk')
800
+			self.FSM.ToTransition(n)
801
+		
802
+	def Exit(self):
803
+		pass
804
+
805
+#==================================== 

+ 3
- 3
scripts/actionsFSMlist.py View File

@@ -3842,7 +3842,7 @@ fak_bsboard_in = a_class(
3842 3842
 	#player armature action name, start, end frames
3843 3843
 	'fak_BS_Board2', 1, 40,
3844 3844
 	#deck action name, start, end frames  
3845
-	'b_reg', 1, 40,
3845
+	'b_fak_bsboard', 1, 40,
3846 3846
 	#layer, speed, mode (0 = play, 1 = loop), blendin
3847 3847
 	1, 1, 0, 10,
3848 3848
 	#intro, length
@@ -3858,7 +3858,7 @@ fak_bsboard = a_class(
3858 3858
 	#player armature action name, start, end frames
3859 3859
 	'fak_BS_Board2', 41, 80,
3860 3860
 	#deck action name, start, end frames  
3861
-	'b_reg', 1, 1,
3861
+	'b_fak_bsboard', 1, 40,
3862 3862
 	#layer, speed, mode (0 = play, 1 = loop), blendin
3863 3863
 	1, .5, 1, 15,
3864 3864
 	#intro, length
@@ -3874,7 +3874,7 @@ fak_fsboard_in = a_class(
3874 3874
 	#player armature action name, start, end frames
3875 3875
 	'fak_FS_Board2', 1, 40,
3876 3876
 	#deck action name, start, end frames  
3877
-	'b_reg', 1, 40,
3877
+	'b_fak_bsboard', 1, 40,
3878 3878
 	#layer, speed, mode (0 = play, 1 = loop), blendin
3879 3879
 	1, 1, 0, 10,
3880 3880
 	#intro, length

+ 12
- 1
scripts/boneRecord.py View File

@@ -12,7 +12,7 @@ deck_list = ['main', 'turn']
12 12
 #bone_list = ['root', 'head']
13 13
 
14 14
 def Record():   
15
-    print('bone recording') 
15
+    #print('bone recording') 
16 16
     scene = bge.logic.getCurrentScene()
17 17
     #own = cont.owner
18 18
     master = scene.objects['control_cube.002']
@@ -50,6 +50,17 @@ def Record():
50 50
         master[str(y) + '-pos'].append(pos)
51 51
         master[str(y) + '-rot'].append(rot)
52 52
 
53
+    # pl = master['foot.ik.R-pos'][len(master['foot.ik.R-pos']) - 1]
54
+
55
+    # if dict['player_class'].obj['ragdoll_active']:
56
+    #     rdfp = armature.worldPosition - scene.objects['npc_ed_arm_phys_foot.ik.R'].worldPosition
57
+    #     print('rd foot pos', rdfp)
58
+    #     #print(dict['player_class'].obj['ragdoll_active'], 'is ragdolling')
59
+    # else:
60
+    #     print('foot pos', pl)
61
+
62
+    #print(len(master['foot.ik.R-pos']), 'br length---')
63
+
53 64
 
54 65
 
55 66
     for y in deck_list:

+ 6
- 4
scripts/controller2.py View File

@@ -611,7 +611,7 @@ def main():
611 611
             if LAST_LEFT_FAK == 0 or (playing_action_frame > (LAND_END - 2) and playing_action_frame < (LAND_END - 1)):
612 612
                 LAST_LEFT_FAK = 1
613 613
             own["LAST_LEFT_FAK"] = 1
614
-            
614
+
615 615
     def fak_stance_left_off():
616 616
         LAST_LEFT_FAK = own["LAST_LEFT_FAK"]
617 617
         own["LAST_LEFT_FAK"] = 0
@@ -1654,7 +1654,9 @@ def main():
1654 1654
 
1655 1655
         if d2 > .3 and own['airup'] == 1 and localRay_v[0] == None:
1656 1656
             #pass
1657
-            own.alignAxisToVect(gray.hitNormal, 2, .03)
1657
+            #own.alignAxisToVect(gray.hitNormal, 2, .03)
1658
+            #own.alignAxisToVect(gray.hitNormal, 2, .08)
1659
+            own.alignAxisToVect([0,0,1], 2, .08)
1658 1660
         if d2 > .3 and own['airup'] == 0 and localRay_v[0] == None:
1659 1661
 
1660 1662
             distance = own.getDistanceTo(gray.hitPosition)
@@ -4267,7 +4269,7 @@ def main():
4267 4269
             own.alignAxisToVect([0.0, 0.0, 1.0], 2, .05)  
4268 4270
         if localRay_v[0] and own['LAST_GRIND'] == False and rBump == 0 and lBump == 0 and ((own['framenum'] - own['last_transition_frame'] < 10) or (own['framenum'] - own['last_vert_frame'] < 10)):
4269 4271
             own['vert'] = 1
4270
-            print('vert hit')
4272
+            #print('vert hit')
4271 4273
             ud_sens = .04      
4272 4274
             if 'spine' in localRay_v[0] and lUD < -.04:
4273 4275
                 if STANCE == True:
@@ -4297,7 +4299,7 @@ def main():
4297 4299
                 #     own.applyMovement((0, 0, (.295 - (localHitDist))), True)
4298 4300
             else:
4299 4301
                 own.alignAxisToVect([0,0,1], 2, .1)
4300
-                print('doing nothing')            
4302
+                #print('doing nothing')            
4301 4303
 
4302 4304
     localHitDist = 1000
4303 4305
     raytof = scene.objects['rayTo_f']

+ 12
- 2
scripts/game.py View File

@@ -2,6 +2,7 @@ import bge
2 2
 import FSM
3 3
 import requests
4 4
 import platform
5
+import os
5 6
 
6 7
 def phone_home():
7 8
 	url = 'https://shuvit.org/phone_home.php'
@@ -12,6 +13,13 @@ def phone_home():
12 13
 	print('phone home response')
13 14
 	print(x.text)
14 15
 
16
+def get_map_list():
17
+	out = []
18
+	ldir = bge.logic.expandPath("//assets/maps")
19
+	out = os.listdir(ldir)
20
+	print('$$$$$$$$$$$$$$$$$$$$$$$out', out)
21
+	return out
22
+
15 23
 def main(cont):
16 24
 	own = cont.owner
17 25
 	dict = bge.logic.globalDict
@@ -21,7 +29,9 @@ def main(cont):
21 29
 		own['cont'] = cont
22 30
 		dict['gameFSM'] = FSM.GameFSM(own)
23 31
 		dict['game_life'] = 0
32
+		dict['maps'] = get_map_list()
24 33
 		#phone_home()
25
-
34
+	if 'game_life' in dict:
35
+		dict['game_life'] += 1
26 36
 	dict['gameFSM'].Execute()
27
-	dict['game_life'] += 1
37
+	

+ 25
- 18
scripts/grindV2.py View File

@@ -330,24 +330,31 @@ def main():
330 330
 
331 331
         #print(own['inverting'])
332 332
         #if frames_grinding > 20 and own['inverting'] == False:
333
-        if frames_grinding > 20:    
334
-            #print("setting stance")
335
-            if (rot == 90 or rot == -270) and STANCE == True:
336
-                #print("90 fak stance")
337
-                own['stance'] = 1
338
-                STANCE = 1
339
-            if (rot == 90 or rot == -270) and STANCE == False:
340
-                #print("90 fak stance")
341
-                own['stance'] = 1
342
-                STANCE = 1
343
-            if (rot == -90 or rot == 270) and STANCE == True:
344
-                #print("-90 reg stance")
345
-                own['stance'] = 0
346
-                STANCE = 0
347
-            if (rot == -90 or rot == 270) and STANCE == False:
348
-                #print("-90 reg stance")
349
-                own['stance'] = 0
350
-                STANCE = 0
333
+        #print('obj', grindDar.hitObjectList[0])
334
+        if 'edge' in grindDar.hitObjectList[0]:
335
+            #print('do not fucking change stance')
336
+
337
+
338
+
339
+
340
+            if frames_grinding > 20:    
341
+                #print("setting stance")
342
+                if (rot == 90 or rot == -270) and STANCE == True:
343
+                    #print("90 fak stance")
344
+                    own['stance'] = 1
345
+                    STANCE = 1
346
+                if (rot == 90 or rot == -270) and STANCE == False:
347
+                    #print("90 fak stance")
348
+                    own['stance'] = 1
349
+                    STANCE = 1
350
+                if (rot == -90 or rot == 270) and STANCE == True:
351
+                    #print("-90 reg stance")
352
+                    own['stance'] = 0
353
+                    STANCE = 0
354
+                if (rot == -90 or rot == 270) and STANCE == False:
355
+                    #print("-90 reg stance")
356
+                    own['stance'] = 0
357
+                    STANCE = 0
351 358
 
352 359
     def grindrotvel(obj):
353 360
         joinit = 0

+ 12
- 0
scripts/levelLibload.py View File

@@ -0,0 +1,12 @@
1
+import bge
2
+
3
+def main(cont):
4
+    own = cont.owner
5
+    scene = bge.logic.getCurrentScene()
6
+    dict = bge.logic.globalDict
7
+    
8
+    mainDir = bge.logic.expandPath("//")
9
+    fileName = mainDir + 'assets/maps/' + dict['map'] + '/map.blend'   
10
+    path = bge.logic.expandPath(fileName)
11
+    bge.logic.LibLoad(path, 'Scene', load_actions=True) 
12
+    

+ 37
- 16
scripts/menuV3.py
File diff suppressed because it is too large
View File


+ 2
- 1
scripts/npause.py View File

@@ -119,7 +119,8 @@ def main(cont):
119 119
         else:
120 120
             cont.activate(cont.actuators['walk'])    
121 121
         try:
122
-            own.setLinearVelocity(own['pre_pause_linvel'], 1) 
122
+            if own['walk'] == False:
123
+                own.setLinearVelocity(own['pre_pause_linvel'], 1) 
123 124
         except:
124 125
             pass    
125 126
         cont.activate(cont.actuators['remove_overlay'])  

+ 29
- 27
scripts/pause_menu2.py View File

@@ -3,39 +3,41 @@ import bge
3 3
 
4 4
 def check_idle():
5 5
     dict = bge.logic.globalDict
6
-    dict['menu_idle_timer'] +=1
7
-    idle = 0
8
-    if dict['aBut'] or dict['bBut'] or dict['xBut'] or dict['yBut'] or dict['ddPad'] or dict['udPad'] or dict['ldPad'] or dict['rdPad'] or (dict['lUD'] > .02 or dict['lUD'] < -.02) or (dict['lLR'] > .02 or dict['lLR'] < -.02) or (dict['rUD'] > .02 or dict['rUD'] < -.02) or (dict['rLR'] > .02 or dict['rLR'] < -.02):
9
-        dict['menu_idle_timer'] = 0
10
-    #print('idtime', dict['menu_idle_timer']) 
11
-    if dict['menu_idle_timer'] > 500:
12
-        idle =1
13
-    return idle                        
6
+    if 'pause_menu_text' in dict:
7
+        dict['menu_idle_timer'] += 1
8
+        idle = 0
9
+        if dict['aBut'] or dict['bBut'] or dict['xBut'] or dict['yBut'] or dict['ddPad'] or dict['udPad'] or dict['ldPad'] or dict['rdPad'] or (dict['lUD'] > .02 or dict['lUD'] < -.02) or (dict['lLR'] > .02 or dict['lLR'] < -.02) or (dict['rUD'] > .02 or dict['rUD'] < -.02) or (dict['rLR'] > .02 or dict['rLR'] < -.02):
10
+            dict['menu_idle_timer'] = 0
11
+        #print('idtime', dict['menu_idle_timer']) 
12
+        if dict['menu_idle_timer'] > 500:
13
+            idle =1
14
+        return idle                        
14 15
 
15 16
 def update_text(cont):
16 17
     own = cont.owner
17 18
     scene = bge.logic.getCurrentScene()
18 19
     dict = bge.logic.globalDict
19
-    if dict['pause_menu_text'] == '':
20
-        scene.objects['menu_text'].text = 'menu > fuck' 
21
-    else:
22
-        if 'menu_text' in scene.objects: 
23
-            scene.objects['menu_text'].text = dict['pause_menu_text']   
24
-        if 'menu_text.001' in scene.objects: 
25
-            scene.objects['menu_text.001'].text = dict['pause_menu_text']               
20
+    if 'pause_menu_text' in dict:
21
+        if dict['pause_menu_text'] == '':
22
+            scene.objects['menu_text'].text = 'menu > fuck' 
23
+        else:
24
+            if 'menu_text' in scene.objects: 
25
+                scene.objects['menu_text'].text = dict['pause_menu_text']   
26
+            if 'menu_text.001' in scene.objects: 
27
+                scene.objects['menu_text.001'].text = dict['pause_menu_text']               
26 28
 
27
-#    scene = bge.logic.getCurrentScene()
28
-    for object in scene.objects:
29
-        if isinstance(object, bge.types.KX_FontObject):
30
-            object.resolution = 16     
31
-                    
32
-    info = ('Music > ' + dict['mu_artist'] + ' - ' + dict['mu_title'])
33
-    #print(info)
34
-    try:
35
-        scene.objects['music_info_txt'].text = info                       
36
-    except:
37
-        pass    
38
-                    
29
+    #    scene = bge.logic.getCurrentScene()
30
+        for object in scene.objects:
31
+            if isinstance(object, bge.types.KX_FontObject):
32
+                object.resolution = 16     
33
+                        
34
+        info = ('Music > ' + dict['mu_artist'] + ' - ' + dict['mu_title'])
35
+        #print(info)
36
+        try:
37
+            scene.objects['music_info_txt'].text = info                       
38
+        except:
39
+            pass    
40
+                        
39 41
                     
40 42
 def main(cont):
41 43
     update_text(cont)  

+ 214
- 111
scripts/player.py View File

@@ -3,6 +3,7 @@ import FSM
3 3
 from mathutils import Vector
4 4
 import math
5 5
 import mathutils
6
+import random
6 7
 
7 8
 dict = bge.logic.globalDict
8 9
 
@@ -18,7 +19,9 @@ class Player:
18 19
 		self.throw_deck_empty = self.obj.childrenRecursive["throw_deck_empty"]
19 20
 		self.step = True
20 21
 		self.dropin_obj = None
21
-
22
+		self.joystick_active_frame = 0
23
+		self.joystick_idle = False
24
+		self.idle_cam_dir = True
22 25
 		#self.throw_deck_obj = dict['level_scene'].objects['throw_deck']
23 26
 		dict['walking'] = True
24 27
 		#print(self.obj.childrenRecursive)
@@ -328,116 +331,116 @@ class Player:
328 331
 
329 332
 	def get_vert_rot(self, own, object):
330 333
 
331
-	        if 'inited' not in object:
332
-	            object['inited'] = True
333
-
334
-	            for mesh in object.meshes:
335
-	                red_verts = []
336
-	                green_verts = []
337
-	                for m_index in range(len(mesh.materials)):
338
-	                    for v_index in range(mesh.getVertexArrayLength(m_index)):
339
-	                        vertex = mesh.getVertex(m_index, v_index)
340
-	                        if vertex.color[0] > .8:
341
-	                            loc = object.worldTransform * vertex.XYZ
342
-	                            red_verts.append(loc.freeze())
343
-	                        if vertex.color[1] > .8:
344
-	                            loc = object.worldTransform * vertex.XYZ
345
-	                            green_verts.append(loc.freeze())
346
-	                           
347
-	            red_verts = set(red_verts)
348
-	            #for v in red_verts:
349
-	                #print(v, 'red_vert')
350
-	            green_verts = set(green_verts)               
351
-	            object['red_verts'] = red_verts
352
-	            object['green_verts'] = green_verts
353
-	            
354
-	            size_red = len(object['red_verts'])
355
-	            kd_red = mathutils.kdtree.KDTree(size_red)
356
-	            size_green = len(object['green_verts'])
357
-	            kd_green = mathutils.kdtree.KDTree(size_green)    
358
-
359
-	            for i, v in enumerate(object['red_verts']):
360
-	                kd_red.insert(v, i)
361
-	            for i, v in enumerate(object['green_verts']):
362
-	                kd_green.insert(v, i)
363
-
364
-	            kd_red.balance()
365
-	            kd_green.balance() 
366
-	            object['kd_red'] = kd_red
367
-	            object['kd_green'] = kd_green    
368
-	            #print('kd built -------')
369
-	            #print(own['kd_red'])
370
-	        # Find the closest points to the player
371
-	        #co_find = control_bottom.worldPosition
372
-	        co_find = own.worldPosition
373
-	        found_red = object['kd_red'].find_n(co_find, 2)
374
-	        found_green = object['kd_green'].find_n(co_find, 1)    
375
-	        
376
-	        primary = Vector(found_red[0][0])
377
-	        secondary = Vector(found_red[1][0])
378
-
379
-	        lineVector = secondary - primary
380
-	        lineVector2 = primary - secondary
381
-	        if found_green != []:
382
-	            lv_green = Vector(found_green[0][0])
383
-	            
384
-	        eul = Vector((1, 0, 0)).rotation_difference(lineVector).to_euler()        
385
-	        
386
-	        te = dict['level_scene'].objects['temp_empty']
387
-	        
388
-
389
-	        rotation = te.worldOrientation.to_euler()
390
-	        if abs(rotation.z) > 3:
391
-	            te.applyRotation([0, 0, 1.570796*2], True)
392
-	        
393
-	        xyz = te.localOrientation.to_euler()
394
-	        xyz[0] = math.radians(0)
395
-	        te.localOrientation = xyz.to_matrix()
396
-
397
-	        if lineVector == Vector([0.0, 0.0, 0.0]):
398
-	            #print('vector is empty')
399
-	            pass
400
-	        else:
401
-	            te.alignAxisToVect(lineVector, 0, 1)
402
-	        
403
-	        te.worldPosition = primary
404
-
405
-	        if found_green != []:
406
-	            local = te.worldOrientation.inverted() * (lv_green - te.worldPosition)
407
-	            if local.y < 0:
408
-	                #print('flip vector')
409
-	                eul = Vector((1, 0, 0)).rotation_difference(lineVector2).to_euler() 
410
-	                if lineVector2 == Vector([0.0, 0.0, 0.0]):
411
-	                    #print('linVector2 is empty')
412
-	                    pass
413
-	                else:
414
-	                    te.alignAxisToVect(lineVector2, 0, 1)
415
-	                #print('align2', lineVector2)
416
-	                te.worldPosition = secondary
417
-	            else:
418
-	                #print('align1', lineVector)  
419
-	                pass
420
-
421
-
422
-	        #flip z axis
423
-
424
-	        #print(local, 'local')
425
-	        
426
-	        myhead = te.worldOrientation.col[2]
427
-	        worldUp = Vector([0,0,1])
428
-	        #worldY = Vector([0,1,0])
429
-	        dot_p = myhead.dot(worldUp)
430
-
431
-	        if dot_p > 0.9:
432
-	            pass
433
-	        else:
434
-	            #print('flip grind object rotation')
435
-	            te.applyRotation([1.570796*2, 0, 0], True)
436
-
437
-
438
-
439
-
440
-	        return eul
334
+			if 'inited' not in object:
335
+				object['inited'] = True
336
+
337
+				for mesh in object.meshes:
338
+					red_verts = []
339
+					green_verts = []
340
+					for m_index in range(len(mesh.materials)):
341
+						for v_index in range(mesh.getVertexArrayLength(m_index)):
342
+							vertex = mesh.getVertex(m_index, v_index)
343
+							if vertex.color[0] > .8:
344
+								loc = object.worldTransform * vertex.XYZ
345
+								red_verts.append(loc.freeze())
346
+							if vertex.color[1] > .8:
347
+								loc = object.worldTransform * vertex.XYZ
348
+								green_verts.append(loc.freeze())
349
+							   
350
+				red_verts = set(red_verts)
351
+				#for v in red_verts:
352
+					#print(v, 'red_vert')
353
+				green_verts = set(green_verts)               
354
+				object['red_verts'] = red_verts
355
+				object['green_verts'] = green_verts
356
+				
357
+				size_red = len(object['red_verts'])
358
+				kd_red = mathutils.kdtree.KDTree(size_red)
359
+				size_green = len(object['green_verts'])
360
+				kd_green = mathutils.kdtree.KDTree(size_green)    
361
+
362
+				for i, v in enumerate(object['red_verts']):
363
+					kd_red.insert(v, i)
364
+				for i, v in enumerate(object['green_verts']):
365
+					kd_green.insert(v, i)
366
+
367
+				kd_red.balance()
368
+				kd_green.balance() 
369
+				object['kd_red'] = kd_red
370
+				object['kd_green'] = kd_green    
371
+				#print('kd built -------')
372
+				#print(own['kd_red'])
373
+			# Find the closest points to the player
374
+			#co_find = control_bottom.worldPosition
375
+			co_find = own.worldPosition
376
+			found_red = object['kd_red'].find_n(co_find, 2)
377
+			found_green = object['kd_green'].find_n(co_find, 1)    
378
+			
379
+			primary = Vector(found_red[0][0])
380
+			secondary = Vector(found_red[1][0])
381
+
382
+			lineVector = secondary - primary
383
+			lineVector2 = primary - secondary
384
+			if found_green != []:
385
+				lv_green = Vector(found_green[0][0])