Browse Source

more pumps

shuvit 5 years ago
parent
commit
76d5884337
3 changed files with 77 additions and 45 deletions
  1. 10
    0
      aiRecord.py
  2. 10
    29
      ai_manager.py
  3. 57
    16
      co_ActionState.py

+ 10
- 0
aiRecord.py View File

@@ -128,6 +128,9 @@ def loadData(cont, own):
128 128
         name2, orientation = readData.returnOrientation(objIndex, valueIndex, own)
129 129
         try:
130 130
             if own['rpStartLoc_set'] == False:
131
+                
132
+                
133
+                
131 134
                 own['rpStartLoc'] = position
132 135
                 print('setting npc_start_pos', position)
133 136
                 
@@ -156,6 +159,13 @@ def loadData(cont, own):
156 159
                 cube.worldPosition = position
157 160
                 deck.worldPosition = position
158 161
                 trucks.worldPosition = position
162
+                
163
+            if 'data_loaded' not in own:
164
+                own['data_loaded'] = 1 
165
+                cube.worldPosition = position
166
+                deck.worldPosition = position
167
+                trucks.worldPosition = position                   
168
+                
159 169
         except:
160 170
             print('npc positioning not working')
161 171
             #pass

+ 10
- 29
ai_manager.py View File

@@ -16,9 +16,6 @@ def printplaying(skater,deck):
16 16
           
17 17
     print(splaying_layers, playing_layers)
18 18
 
19
-
20
-
21
-
22 19
 def main():
23 20
 
24 21
     frame_rate = 60    #Set this to the framerate of your game.
@@ -35,12 +32,13 @@ def main():
35 32
     from mathutils import Vector
36 33
     import math
37 34
     
35
+    debugg = True
38 36
 
39 37
     cont = logic.getCurrentController()
40 38
     own = cont.owner
41 39
     scene = logic.getCurrentScene()
42 40
     dict = logic.globalDict
43
-    own['valueIndex'] = own['valueIndex'] + 20
41
+    own['valueIndex'] = own['valueIndex'] + 2
44 42
     #dict['recorder_on'] = recorder_on
45 43
     npc_index = own['npc_index']
46 44
     skater = dict['spawned_npcs'][npc_index]
@@ -51,9 +49,14 @@ def main():
51 49
     recording_cutoff = own['replay_length']
52 50
     idle_timer = own['idle_timer']
53 51
     npc_playback = own['npc_playback']
52
+    
53
+    
54
+    
54 55
     if 'data_loaded' not in own:
55
-        own['data_loaded'] = 1
56
+        #own['data_loaded'] = 1
56 57
         aiRecord.loadData(cont, own)
58
+        if debugg: print('ai_loadData')
59
+        
57 60
     if npc_playback == True:
58 61
         cube = own
59 62
         aiRecord.loadData(cont, own)   
@@ -68,14 +71,7 @@ def main():
68 71
             own['objIndex'] = own['objIndex'] + 2
69 72
         else:
70 73
             own['objIndex'] = 4   
71
-            print('replay end') 
72
-#            try:
73
-#                tActu = cont.actuators['npcSteering']
74
-#                cont.deactivate(tActu)
75
-
76
-#                
77
-#            except:
78
-#                print('no target to delete')    
74
+            print('replay end')    
79 75
             npcChangeAnim.main(cont)
80 76
             #own['npc_replay_name'] = '30secA.dat'
81 77
             own['inited'] = False
@@ -89,22 +85,7 @@ def main():
89 85
             #print('idling', idle_timer)
90 86
         else:
91 87
             idle_timer = 0
92
-            own['npc_rotate'] = True 
93
-#    if own['npc_rotate'] == True:
94
-#        xyz = own.localOrientation.to_euler()
95
-#        rotz = math.degrees(xyz[2])
96
-#        print (rotz, own['rpStartZ'], '---rotations')
97
-#        num = rotz - own['rpStartZ']
98
-#        amt = .05
99
-#        amt2 = 2
100
-#        if abs(num) < amt2:
101
-#            own['npc_playback'] = True
102
-#            own['npc_rotate'] = False
103
-#            print('----starting replay', num)
104
-#        elif rotz > own['rpStartZ']:
105
-#            own.applyRotation([0,0,-amt], True)
106
-#        elif rotz < own['rpStartZ']:
107
-#            own.applyRotation([0,0,amt], True)                 
88
+            own['npc_rotate'] = True                 
108 89
             
109 90
     if own['move'] == True:
110 91
         speed = .15

+ 57
- 16
co_ActionState.py
File diff suppressed because it is too large
View File


Loading…
Cancel
Save