|
@@ -9,1052 +9,1054 @@ import math
|
9
|
9
|
|
10
|
10
|
def main(cont):
|
11
|
11
|
|
12
|
|
- scene = bge.logic.getCurrentScene()
|
13
|
|
- objList = scene.objects
|
14
|
|
- cont = GameLogic.getCurrentController()
|
15
|
|
- obj = bge.logic.getCurrentScene().objects
|
16
|
|
- char = bge.constraints.getCharacter
|
17
|
|
- own = cont.owner
|
18
|
|
- stance = own['stance']
|
19
|
|
- STANCE = own['stance']
|
20
|
|
- r_ground = cont.sensors["r_Ground"]
|
21
|
|
- linvel = own.getLinearVelocity(True)
|
22
|
|
- lasta = own['lasta']
|
23
|
|
- lastx = own['lastx']
|
24
|
|
- last_sit = own['sit']
|
25
|
|
- dict = bge.logic.globalDict
|
|
12
|
+ pass
|
26
|
13
|
|
27
|
|
- try:
|
28
|
|
- own['walk_timer'] = own['walk_timer'] +1
|
29
|
|
- except:
|
30
|
|
- own['walk_timer'] = 1
|
31
|
|
- own['walk_targ_speed'] = 2.0
|
|
14
|
+ # scene = bge.logic.getCurrentScene()
|
|
15
|
+ # objList = scene.objects
|
|
16
|
+ # cont = GameLogic.getCurrentController()
|
|
17
|
+ # obj = bge.logic.getCurrentScene().objects
|
|
18
|
+ # char = bge.constraints.getCharacter
|
|
19
|
+ # own = cont.owner
|
|
20
|
+ # stance = own['stance']
|
|
21
|
+ # STANCE = own['stance']
|
|
22
|
+ # r_ground = cont.sensors["r_Ground"]
|
|
23
|
+ # linvel = own.getLinearVelocity(True)
|
|
24
|
+ # lasta = own['lasta']
|
|
25
|
+ # lastx = own['lastx']
|
|
26
|
+ # last_sit = own['sit']
|
|
27
|
+ # dict = bge.logic.globalDict
|
32
|
28
|
|
33
|
|
- truckon = 450
|
34
|
|
- deckon = 460
|
|
29
|
+ # try:
|
|
30
|
+ # own['walk_timer'] = own['walk_timer'] +1
|
|
31
|
+ # except:
|
|
32
|
+ # own['walk_timer'] = 1
|
|
33
|
+ # own['walk_targ_speed'] = 2.0
|
35
|
34
|
|
36
|
|
- lLR = dict['lLR']
|
37
|
|
- lUD = dict['lUD']
|
38
|
|
- rLR = dict['rLR']
|
39
|
|
- rUD = dict['rUD']
|
40
|
|
- lTrig = dict['lTrig']
|
41
|
|
- rTrig = dict['rTrig']
|
42
|
|
- aBut = dict['aBut']
|
43
|
|
- bBut = dict['bBut']
|
44
|
|
- xBut = dict['xBut']
|
45
|
|
- yBut = dict['yBut']
|
46
|
|
- lBump = dict['lBump']
|
47
|
|
- rBump = dict['rBump']
|
48
|
|
- bkBut = dict['bkBut']
|
49
|
|
- stBut = dict['stBut']
|
50
|
|
- xbBut = dict['xbBut']
|
51
|
|
- ltsBut = dict['ltsBut']
|
52
|
|
- rtsBut = dict['rtsBut']
|
53
|
|
- ldPad = dict['ldPad']
|
54
|
|
- rdPad = dict['rdPad']
|
55
|
|
- udPad = dict['udPad']
|
56
|
|
- ddPad = dict['ddPad']
|
|
35
|
+ # truckon = 450
|
|
36
|
+ # deckon = 460
|
57
|
37
|
|
58
|
|
- #user
|
59
|
|
- sens = .04
|
60
|
|
- fliplay = 30
|
61
|
|
- dropinCol = own.sensors['dropinCol']
|
62
|
|
- cube = scene.objects['control_cube.002']
|
63
|
|
- skater = scene.objects["Char4"]
|
64
|
|
- deck = scene.objects["b_deck"]
|
65
|
|
- trucks = scene.objects["b_trucks"]
|
66
|
|
- camobj2 = scene.objects['camobj']
|
67
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
68
|
|
- wheel1 = scene.objects["wheel1"]
|
69
|
|
- wheel2 = scene.objects["wheel2"]
|
70
|
|
- wheel3 = scene.objects["wheel3"]
|
71
|
|
- wheel4 = scene.objects["wheel4"]
|
72
|
|
- camobj = scene.objects["Camera.003"]
|
73
|
|
- camera = cont.actuators["Camera"]
|
74
|
|
- replayCam = cont.actuators["replayCam"]
|
75
|
|
- timer = own['dropinTimer']
|
76
|
|
- cam = scene.objects["Camera.003"]
|
77
|
|
- freecam = scene.objects["freecam"]
|
78
|
|
- followcam = scene.objects["followcam"]
|
|
38
|
+ # lLR = dict['lLR']
|
|
39
|
+ # lUD = dict['lUD']
|
|
40
|
+ # rLR = dict['rLR']
|
|
41
|
+ # rUD = dict['rUD']
|
|
42
|
+ # lTrig = dict['lTrig']
|
|
43
|
+ # rTrig = dict['rTrig']
|
|
44
|
+ # aBut = dict['aBut']
|
|
45
|
+ # bBut = dict['bBut']
|
|
46
|
+ # xBut = dict['xBut']
|
|
47
|
+ # yBut = dict['yBut']
|
|
48
|
+ # lBump = dict['lBump']
|
|
49
|
+ # rBump = dict['rBump']
|
|
50
|
+ # bkBut = dict['bkBut']
|
|
51
|
+ # stBut = dict['stBut']
|
|
52
|
+ # xbBut = dict['xbBut']
|
|
53
|
+ # ltsBut = dict['ltsBut']
|
|
54
|
+ # rtsBut = dict['rtsBut']
|
|
55
|
+ # ldPad = dict['ldPad']
|
|
56
|
+ # rdPad = dict['rdPad']
|
|
57
|
+ # udPad = dict['udPad']
|
|
58
|
+ # ddPad = dict['ddPad']
|
79
|
59
|
|
80
|
|
- control_bottom = scene.objects['control_bottom']
|
81
|
|
- cb = control_bottom.sensors['grindCol_bottom']
|
82
|
|
- cb_td = control_bottom.sensors['td_bottom']
|
|
60
|
+ # #user
|
|
61
|
+ # sens = .04
|
|
62
|
+ # fliplay = 30
|
|
63
|
+ # dropinCol = own.sensors['dropinCol']
|
|
64
|
+ # cube = scene.objects['control_cube.002']
|
|
65
|
+ # skater = scene.objects["Char4"]
|
|
66
|
+ # deck = scene.objects["b_deck"]
|
|
67
|
+ # trucks = scene.objects["b_trucks"]
|
|
68
|
+ # camobj2 = scene.objects['camobj']
|
|
69
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
70
|
+ # wheel1 = scene.objects["wheel1"]
|
|
71
|
+ # wheel2 = scene.objects["wheel2"]
|
|
72
|
+ # wheel3 = scene.objects["wheel3"]
|
|
73
|
+ # wheel4 = scene.objects["wheel4"]
|
|
74
|
+ # camobj = scene.objects["Camera.003"]
|
|
75
|
+ # camera = cont.actuators["Camera"]
|
|
76
|
+ # replayCam = cont.actuators["replayCam"]
|
|
77
|
+ # timer = own['dropinTimer']
|
|
78
|
+ # cam = scene.objects["Camera.003"]
|
|
79
|
+ # freecam = scene.objects["freecam"]
|
|
80
|
+ # followcam = scene.objects["followcam"]
|
83
|
81
|
|
84
|
|
- noidle = 0
|
|
82
|
+ # control_bottom = scene.objects['control_bottom']
|
|
83
|
+ # cb = control_bottom.sensors['grindCol_bottom']
|
|
84
|
+ # cb_td = control_bottom.sensors['td_bottom']
|
85
|
85
|
|
86
|
|
- #if skater.isPlayingAction(460):
|
87
|
|
- # noidle = 1
|
|
86
|
+ # noidle = 0
|
88
|
87
|
|
|
88
|
+ # #if skater.isPlayingAction(460):
|
|
89
|
+ # # noidle = 1
|
89
|
90
|
|
90
|
|
- try:
|
91
|
|
- walk_inc = own['walk_inc']
|
92
|
|
- except:
|
93
|
|
- own['walk_inc'] = .01
|
94
|
|
- walk_inc = own['walk_inc']
|
95
|
|
- own['walk_jump_timer'] = 0
|
96
|
|
- if own['stair_counter'] != 0:
|
97
|
|
- walk_inc = own['walk_inc'] *10
|
98
|
91
|
|
99
|
|
- if own["stance"] == None:
|
100
|
|
- own["stance"] = True
|
101
|
|
- STANCE = own["stance"]
|
102
|
|
- def killact(layer):
|
103
|
|
- if skater.isPlayingAction(layer):
|
104
|
|
- skater.stopAction(layer)
|
105
|
|
- if deck.isPlayingAction(layer):
|
106
|
|
- deck.stopAction(layer)
|
107
|
|
- if trucks.isPlayingAction(layer):
|
108
|
|
- trucks.stopAction(layer)
|
109
|
|
- def killall():
|
110
|
|
- for x in range(5000):
|
111
|
|
- skater.stopAction(x)
|
112
|
|
- deck.stopAction(x)
|
113
|
|
- trucks.stopAction(x)
|
114
|
|
- def trucksisplaying():
|
115
|
|
- for x in range(5000):
|
116
|
|
- if deck.isPlayingAction(x):
|
117
|
|
- print("deck is playing:", x)
|
|
92
|
+ # try:
|
|
93
|
+ # walk_inc = own['walk_inc']
|
|
94
|
+ # except:
|
|
95
|
+ # own['walk_inc'] = .01
|
|
96
|
+ # walk_inc = own['walk_inc']
|
|
97
|
+ # own['walk_jump_timer'] = 0
|
|
98
|
+ # if own['stair_counter'] != 0:
|
|
99
|
+ # walk_inc = own['walk_inc'] *10
|
118
|
100
|
|
119
|
|
- def printplaying():
|
120
|
|
- splaying_layers = "S: "
|
121
|
|
- playing_layers = "D: "
|
122
|
|
- tplaying_layers = "T: "
|
123
|
|
- for x in range(9900):
|
124
|
|
- if skater.isPlayingAction(x):
|
125
|
|
- #if trucks.isPlayingAction(x):
|
126
|
|
- #if skater.isPlayingAction(x):
|
127
|
|
- splaying_layers += str(x)
|
128
|
|
- splaying_layers += " "
|
129
|
|
- if deck.isPlayingAction(x):
|
130
|
|
- #if trucks.isPlayingAction(x):
|
131
|
|
- #if skater.isPlayingAction(x):
|
132
|
|
- playing_layers += str(x)
|
133
|
|
- playing_layers += " "
|
134
|
|
- if trucks.isPlayingAction(x):
|
135
|
|
- #if trucks.isPlayingAction(x):
|
136
|
|
- #if skater.isPlayingAction(x):
|
137
|
|
- tplaying_layers += str(x)
|
138
|
|
- tplaying_layers += " "
|
139
|
|
- print(splaying_layers, playing_layers, tplaying_layers)
|
140
|
|
- #printplaying()
|
141
|
|
- ##
|
142
|
|
- if r_ground.positive and xBut == False and lastx == False:
|
143
|
|
- killact(10)
|
144
|
|
- #killact(11)
|
145
|
|
- killact(12)
|
146
|
|
- killact(13)
|
147
|
|
- ######################################
|
|
101
|
+ # if own["stance"] == None:
|
|
102
|
+ # own["stance"] = True
|
|
103
|
+ # STANCE = own["stance"]
|
|
104
|
+ # def killact(layer):
|
|
105
|
+ # if skater.isPlayingAction(layer):
|
|
106
|
+ # skater.stopAction(layer)
|
|
107
|
+ # if deck.isPlayingAction(layer):
|
|
108
|
+ # deck.stopAction(layer)
|
|
109
|
+ # if trucks.isPlayingAction(layer):
|
|
110
|
+ # trucks.stopAction(layer)
|
|
111
|
+ # def killall():
|
|
112
|
+ # for x in range(5000):
|
|
113
|
+ # skater.stopAction(x)
|
|
114
|
+ # deck.stopAction(x)
|
|
115
|
+ # trucks.stopAction(x)
|
|
116
|
+ # def trucksisplaying():
|
|
117
|
+ # for x in range(5000):
|
|
118
|
+ # if deck.isPlayingAction(x):
|
|
119
|
+ # print("deck is playing:", x)
|
148
|
120
|
|
149
|
|
- #idle
|
150
|
|
- #if stance == 0 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
|
151
|
|
- #own['requestAction'] = 'reg_idle'
|
152
|
|
- #if own['throw_deck'] == True:
|
153
|
|
- #own['requestAction'] = 'reg_idle_nb'
|
|
121
|
+ # def printplaying():
|
|
122
|
+ # splaying_layers = "S: "
|
|
123
|
+ # playing_layers = "D: "
|
|
124
|
+ # tplaying_layers = "T: "
|
|
125
|
+ # for x in range(9900):
|
|
126
|
+ # if skater.isPlayingAction(x):
|
|
127
|
+ # #if trucks.isPlayingAction(x):
|
|
128
|
+ # #if skater.isPlayingAction(x):
|
|
129
|
+ # splaying_layers += str(x)
|
|
130
|
+ # splaying_layers += " "
|
|
131
|
+ # if deck.isPlayingAction(x):
|
|
132
|
+ # #if trucks.isPlayingAction(x):
|
|
133
|
+ # #if skater.isPlayingAction(x):
|
|
134
|
+ # playing_layers += str(x)
|
|
135
|
+ # playing_layers += " "
|
|
136
|
+ # if trucks.isPlayingAction(x):
|
|
137
|
+ # #if trucks.isPlayingAction(x):
|
|
138
|
+ # #if skater.isPlayingAction(x):
|
|
139
|
+ # tplaying_layers += str(x)
|
|
140
|
+ # tplaying_layers += " "
|
|
141
|
+ # print(splaying_layers, playing_layers, tplaying_layers)
|
|
142
|
+ # #printplaying()
|
|
143
|
+ # ##
|
|
144
|
+ # if r_ground.positive and xBut == False and lastx == False:
|
|
145
|
+ # killact(10)
|
|
146
|
+ # #killact(11)
|
|
147
|
+ # killact(12)
|
|
148
|
+ # killact(13)
|
|
149
|
+ # ######################################
|
154
|
150
|
|
155
|
|
- #if stance == 1 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
|
156
|
|
- #own['requestAction'] = 'fak_idle'
|
157
|
|
- #if own['throw_deck'] == True:
|
158
|
|
- #own['requestAction'] = 'fak_idle_nb'
|
|
151
|
+ # #idle
|
|
152
|
+ # #if stance == 0 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
|
|
153
|
+ # #own['requestAction'] = 'reg_idle'
|
|
154
|
+ # #if own['throw_deck'] == True:
|
|
155
|
+ # #own['requestAction'] = 'reg_idle_nb'
|
159
|
156
|
|
160
|
|
- if lUD < -sens:
|
161
|
|
- lup = 1
|
162
|
|
- else:
|
163
|
|
- lup = 0
|
164
|
|
- if lUD > sens:
|
165
|
|
- ldown = 1
|
166
|
|
- else:
|
167
|
|
- ldown = 0
|
168
|
|
- if lLR < -sens:
|
169
|
|
- lLeft = 1
|
170
|
|
- else:
|
171
|
|
- lLeft = 0
|
172
|
|
- if lLR > sens:
|
173
|
|
- lRight = 1
|
174
|
|
- else:
|
175
|
|
- lRight = 0
|
|
157
|
+ # #if stance == 1 and skater.isPlayingAction(fliplay) == False and yBut == False and r_ground.triggered and xBut == False and noidle == 0 and own['walk_idling'] == 0 and own['sit'] == 0 and own['dropinTimer'] == 0 and own['lasty'] == False:
|
|
158
|
+ # #own['requestAction'] = 'fak_idle'
|
|
159
|
+ # #if own['throw_deck'] == True:
|
|
160
|
+ # #own['requestAction'] = 'fak_idle_nb'
|
176
|
161
|
|
|
162
|
+ # if lUD < -sens:
|
|
163
|
+ # lup = 1
|
|
164
|
+ # else:
|
|
165
|
+ # lup = 0
|
|
166
|
+ # if lUD > sens:
|
|
167
|
+ # ldown = 1
|
|
168
|
+ # else:
|
|
169
|
+ # ldown = 0
|
|
170
|
+ # if lLR < -sens:
|
|
171
|
+ # lLeft = 1
|
|
172
|
+ # else:
|
|
173
|
+ # lLeft = 0
|
|
174
|
+ # if lLR > sens:
|
|
175
|
+ # lRight = 1
|
|
176
|
+ # else:
|
|
177
|
+ # lRight = 0
|
177
|
178
|
|
178
|
179
|
|
179
|
|
- #turning
|
180
|
|
- walk_turn_amt = .005#.05
|
181
|
|
- turning = False
|
182
|
|
- if r_ground.positive:
|
183
|
|
- num = .4#.5
|
184
|
|
- tilt = .015
|
185
|
|
- if STANCE == 1:
|
186
|
|
- num *= -1
|
187
|
|
- tilt *= -1
|
188
|
|
- if lRight == 1 or dict['kb_ra'] == 2:
|
189
|
|
- #cont.activate(own.actuators['right'])
|
190
|
|
- own.linearVelocity.y = num
|
191
|
|
- if own['stair_counter'] > 0:
|
192
|
|
- if STANCE == 0:
|
193
|
|
- own.applyRotation([0,0,walk_turn_amt], True)
|
194
|
|
- else:
|
195
|
|
- own.applyRotation([0,0,-walk_turn_amt], True)
|
196
|
|
- else:
|
197
|
|
- own.applyRotation([-tilt, 0, 0], True)
|
198
|
|
- turning = True
|
199
|
|
- else:
|
200
|
|
- #cont.deactivate(own.actuators['right'])
|
201
|
|
- pass
|
|
180
|
+
|
|
181
|
+ # #turning
|
|
182
|
+ # walk_turn_amt = .005#.05
|
|
183
|
+ # turning = False
|
|
184
|
+ # if r_ground.positive:
|
|
185
|
+ # num = .4#.5
|
|
186
|
+ # tilt = .015
|
|
187
|
+ # if STANCE == 1:
|
|
188
|
+ # num *= -1
|
|
189
|
+ # tilt *= -1
|
|
190
|
+ # if lRight == 1 or dict['kb_ra'] == 2:
|
|
191
|
+ # #cont.activate(own.actuators['right'])
|
|
192
|
+ # own.linearVelocity.y = num
|
|
193
|
+ # if own['stair_counter'] > 0:
|
|
194
|
+ # if STANCE == 0:
|
|
195
|
+ # own.applyRotation([0,0,walk_turn_amt], True)
|
|
196
|
+ # else:
|
|
197
|
+ # own.applyRotation([0,0,-walk_turn_amt], True)
|
|
198
|
+ # else:
|
|
199
|
+ # own.applyRotation([-tilt, 0, 0], True)
|
|
200
|
+ # turning = True
|
|
201
|
+ # else:
|
|
202
|
+ # #cont.deactivate(own.actuators['right'])
|
|
203
|
+ # pass
|
202
|
204
|
|
203
|
|
- if lLeft == 1 or dict['kb_la'] == 2:
|
204
|
|
- #cont.activate(own.actuators['left'])
|
205
|
|
- own.linearVelocity.y = -num
|
206
|
|
- if own['stair_counter'] > 0:
|
207
|
|
- if STANCE == 0:
|
208
|
|
- own.applyRotation([0,0,walk_turn_amt], True)
|
209
|
|
- else:
|
210
|
|
- own.applyRotation([0,0,-walk_turn_amt], True)
|
211
|
|
- else:
|
212
|
|
- own.applyRotation([tilt, 0, 0], True)
|
213
|
|
- turning = True
|
214
|
|
- else:
|
215
|
|
- #cont.deactivate(own.actuators['left'])
|
216
|
|
- pass
|
|
205
|
+ # if lLeft == 1 or dict['kb_la'] == 2:
|
|
206
|
+ # #cont.activate(own.actuators['left'])
|
|
207
|
+ # own.linearVelocity.y = -num
|
|
208
|
+ # if own['stair_counter'] > 0:
|
|
209
|
+ # if STANCE == 0:
|
|
210
|
+ # own.applyRotation([0,0,walk_turn_amt], True)
|
|
211
|
+ # else:
|
|
212
|
+ # own.applyRotation([0,0,-walk_turn_amt], True)
|
|
213
|
+ # else:
|
|
214
|
+ # own.applyRotation([tilt, 0, 0], True)
|
|
215
|
+ # turning = True
|
|
216
|
+ # else:
|
|
217
|
+ # #cont.deactivate(own.actuators['left'])
|
|
218
|
+ # pass
|
217
|
219
|
|
218
|
|
- #in air
|
219
|
|
- #if (lup == 1 or dict['kb_ua'] != 0) and r_ground.positive == False:
|
220
|
|
- if r_ground.positive == False:
|
221
|
|
- airrot = .05
|
222
|
|
- if lLeft == 1 or dict['kb_la'] == 2:
|
223
|
|
- if stance == 0:
|
224
|
|
- own.applyRotation([0,0,airrot], True)
|
225
|
|
- if stance == 1:
|
226
|
|
- own.applyRotation([0,0,airrot], True)
|
227
|
|
- if lRight == 1 or dict['kb_ra'] == 2:
|
228
|
|
- if stance == 0:
|
229
|
|
- own.applyRotation([0,0,-airrot], True)
|
230
|
|
- if stance == 1:
|
231
|
|
- own.applyRotation([0,0,-airrot], True)
|
|
220
|
+ # #in air
|
|
221
|
+ # #if (lup == 1 or dict['kb_ua'] != 0) and r_ground.positive == False:
|
|
222
|
+ # if r_ground.positive == False:
|
|
223
|
+ # airrot = .05
|
|
224
|
+ # if lLeft == 1 or dict['kb_la'] == 2:
|
|
225
|
+ # if stance == 0:
|
|
226
|
+ # own.applyRotation([0,0,airrot], True)
|
|
227
|
+ # if stance == 1:
|
|
228
|
+ # own.applyRotation([0,0,airrot], True)
|
|
229
|
+ # if lRight == 1 or dict['kb_ra'] == 2:
|
|
230
|
+ # if stance == 0:
|
|
231
|
+ # own.applyRotation([0,0,-airrot], True)
|
|
232
|
+ # if stance == 1:
|
|
233
|
+ # own.applyRotation([0,0,-airrot], True)
|
232
|
234
|
|
233
|
|
- if lup == 1 or dict['kb_ua'] == 2:
|
234
|
|
- if own.linearVelocity.x < 10 and own .linearVelocity.x > - 10:
|
235
|
|
- if stance == 0:
|
236
|
|
- own.linearVelocity.x -= .04
|
237
|
|
- if stance == 1:
|
238
|
|
- own.linearVelocity.x += .04
|
239
|
|
- own['lF_air_frame'] = own['framenum']
|
240
|
|
- own.actuators["walkondirt"].stopSound()
|
|
235
|
+ # if lup == 1 or dict['kb_ua'] == 2:
|
|
236
|
+ # if own.linearVelocity.x < 10 and own .linearVelocity.x > - 10:
|
|
237
|
+ # if stance == 0:
|
|
238
|
+ # own.linearVelocity.x -= .04
|
|
239
|
+ # if stance == 1:
|
|
240
|
+ # own.linearVelocity.x += .04
|
|
241
|
+ # own['lF_air_frame'] = own['framenum']
|
|
242
|
+ # own.actuators["walkondirt"].stopSound()
|
241
|
243
|
|
242
|
244
|
|
243
|
|
- #walking
|
|
245
|
+ # #walking
|
244
|
246
|
|
245
|
|
- #new walking
|
246
|
|
- vel = own.getLinearVelocity(True)
|
247
|
|
- if own['walk_timer'] < 50:
|
248
|
|
- velx = vel.x * .95
|
249
|
|
- own.setLinearVelocity([velx, 0, vel.z], True)
|
250
|
|
- #print('y is zero')
|
251
|
|
- else:
|
252
|
|
- pass
|
253
|
|
- #own.setLinearVelocity([0, 0, vel.z], True)
|
|
247
|
+ # #new walking
|
|
248
|
+ # vel = own.getLinearVelocity(True)
|
|
249
|
+ # if own['walk_timer'] < 50:
|
|
250
|
+ # velx = vel.x * .95
|
|
251
|
+ # own.setLinearVelocity([velx, 0, vel.z], True)
|
|
252
|
+ # #print('y is zero')
|
|
253
|
+ # else:
|
|
254
|
+ # pass
|
|
255
|
+ # #own.setLinearVelocity([0, 0, vel.z], True)
|
254
|
256
|
|
255
|
|
- wf = 1
|
256
|
|
- if own['last_walk_frame'] - own['last_roll_frame'] > 55:
|
257
|
|
- wf = 0
|
|
257
|
+ # wf = 1
|
|
258
|
+ # if own['last_walk_frame'] - own['last_roll_frame'] > 55:
|
|
259
|
+ # wf = 0
|
258
|
260
|
|
259
|
|
- if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0)) and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] == 0:
|
260
|
|
- own['walking'] = "regular"
|
261
|
|
- walking = "regular"
|
|
261
|
+ # if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0)) and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] == 0:
|
|
262
|
+ # own['walking'] = "regular"
|
|
263
|
+ # walking = "regular"
|
262
|
264
|
|
263
|
|
- elif ((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] != 2:
|
264
|
|
- own['walking'] = "fast"
|
265
|
|
- walking = "fast"
|
266
|
|
- else:
|
267
|
|
- own['walking'] = None
|
268
|
|
- walking = None
|
|
265
|
+ # elif ((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0 and wf == 0 and dict['kb_space'] != 2:
|
|
266
|
+ # own['walking'] = "fast"
|
|
267
|
+ # walking = "fast"
|
|
268
|
+ # else:
|
|
269
|
+ # own['walking'] = None
|
|
270
|
+ # walking = None
|
269
|
271
|
|
270
|
|
- if walking == "regular":
|
271
|
|
- if stance == 1:
|
272
|
|
- if linvel.x < own['walk_targ_speed']:
|
273
|
|
- own.linearVelocity.x = linvel.x + walk_inc
|
274
|
|
- else:
|
275
|
|
- own.linearVelocity.x = own['walk_targ_speed']
|
276
|
|
- else:
|
277
|
|
- if linvel.x > -own['walk_targ_speed']:
|
278
|
|
- own.linearVelocity.x = linvel.x - walk_inc
|
279
|
|
- else:
|
280
|
|
- own.linearVelocity.x = -own['walk_targ_speed']
|
281
|
|
- if walking == "fast":
|
282
|
|
- if stance == 1:
|
283
|
|
- if linvel.x < own['walk_fast_targ_speed']:
|
284
|
|
- own.linearVelocity.x = linvel.x + walk_inc
|
285
|
|
- else:
|
286
|
|
- own.linearVelocity.x = own['walk_fast_targ_speed']
|
287
|
|
- else:
|
288
|
|
- if linvel.x > -own['walk_fast_targ_speed']:
|
289
|
|
- own.linearVelocity.x = linvel.x - walk_inc
|
290
|
|
- else:
|
291
|
|
- own.linearVelocity.x = -own['walk_fast_targ_speed']
|
|
272
|
+ # if walking == "regular":
|
|
273
|
+ # if stance == 1:
|
|
274
|
+ # if linvel.x < own['walk_targ_speed']:
|
|
275
|
+ # own.linearVelocity.x = linvel.x + walk_inc
|
|
276
|
+ # else:
|
|
277
|
+ # own.linearVelocity.x = own['walk_targ_speed']
|
|
278
|
+ # else:
|
|
279
|
+ # if linvel.x > -own['walk_targ_speed']:
|
|
280
|
+ # own.linearVelocity.x = linvel.x - walk_inc
|
|
281
|
+ # else:
|
|
282
|
+ # own.linearVelocity.x = -own['walk_targ_speed']
|
|
283
|
+ # if walking == "fast":
|
|
284
|
+ # if stance == 1:
|
|
285
|
+ # if linvel.x < own['walk_fast_targ_speed']:
|
|
286
|
+ # own.linearVelocity.x = linvel.x + walk_inc
|
|
287
|
+ # else:
|
|
288
|
+ # own.linearVelocity.x = own['walk_fast_targ_speed']
|
|
289
|
+ # else:
|
|
290
|
+ # if linvel.x > -own['walk_fast_targ_speed']:
|
|
291
|
+ # own.linearVelocity.x = linvel.x - walk_inc
|
|
292
|
+ # else:
|
|
293
|
+ # own.linearVelocity.x = -own['walk_fast_targ_speed']
|
292
|
294
|
|
293
|
|
- if walking == None and r_ground.positive and own['walk_jump_timer'] == 0:
|
294
|
|
- if own['walk_timer'] < 50 and turning == False:
|
295
|
|
- velx = vel.x * .95
|
296
|
|
- own.setLinearVelocity([velx, 0, vel.z], True)
|
297
|
|
- elif own['walk_timer'] > 50:
|
298
|
|
- if own.linearVelocity.x > .1 or own.linearVelocity.x < -.1:
|
299
|
|
- own.linearVelocity.x *= .01
|
300
|
|
- else:
|
301
|
|
- own.linearVelocity.x = 0
|
302
|
|
- if turning == False:
|
303
|
|
- if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
|
304
|
|
- own.linearVelocity.y *= .01
|
305
|
|
- else:
|
306
|
|
- own.linearVelocity.y = 0
|
307
|
|
- #own.setLinearVelocity([0, 0, vel.z], True)
|
|
295
|
+ # if walking == None and r_ground.positive and own['walk_jump_timer'] == 0:
|
|
296
|
+ # if own['walk_timer'] < 50 and turning == False:
|
|
297
|
+ # velx = vel.x * .95
|
|
298
|
+ # own.setLinearVelocity([velx, 0, vel.z], True)
|
|
299
|
+ # elif own['walk_timer'] > 50:
|
|
300
|
+ # if own.linearVelocity.x > .1 or own.linearVelocity.x < -.1:
|
|
301
|
+ # own.linearVelocity.x *= .01
|
|
302
|
+ # else:
|
|
303
|
+ # own.linearVelocity.x = 0
|
|
304
|
+ # if turning == False:
|
|
305
|
+ # if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01:
|
|
306
|
+ # own.linearVelocity.y *= .01
|
|
307
|
+ # else:
|
|
308
|
+ # own.linearVelocity.y = 0
|
|
309
|
+ # #own.setLinearVelocity([0, 0, vel.z], True)
|
308
|
310
|
|
309
|
|
- #old walking
|
310
|
|
- if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 0):
|
311
|
|
- own.actuators["walkondirt"].volume = .2
|
312
|
|
- own.actuators["walkondirt"].pitch = 1
|
313
|
|
- cont.activate(own.actuators["walkondirt"])
|
314
|
|
- if stance == 0 and skater.isPlayingAction(fliplay) == False:
|
315
|
|
- #without deck
|
316
|
|
- if own['throw_deck'] == True:
|
317
|
|
- own['requestAction'] = 'reg_walk_nb'
|
318
|
|
- else:
|
319
|
|
- own['requestAction'] = 'reg_walk'
|
|
311
|
+ # #old walking
|
|
312
|
+ # if ((lup == 1 and aBut == 0) or (dict['kb_ua'] == 2 and dict['kb_lsh'] == 0) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 0):
|
|
313
|
+ # own.actuators["walkondirt"].volume = .2
|
|
314
|
+ # own.actuators["walkondirt"].pitch = 1
|
|
315
|
+ # cont.activate(own.actuators["walkondirt"])
|
|
316
|
+ # if stance == 0 and skater.isPlayingAction(fliplay) == False:
|
|
317
|
+ # #without deck
|
|
318
|
+ # if own['throw_deck'] == True:
|
|
319
|
+ # own['requestAction'] = 'reg_walk_nb'
|
|
320
|
+ # else:
|
|
321
|
+ # own['requestAction'] = 'reg_walk'
|
320
|
322
|
|
321
|
|
- if stance == 1 and skater.isPlayingAction(fliplay) == False:
|
322
|
|
- #without deck
|
323
|
|
- if own['throw_deck'] == True:
|
324
|
|
- own['requestAction'] = 'fak_walk_nb'
|
325
|
|
- else:
|
326
|
|
- own['requestAction'] = 'fak_walk'
|
|
323
|
+ # if stance == 1 and skater.isPlayingAction(fliplay) == False:
|
|
324
|
+ # #without deck
|
|
325
|
+ # if own['throw_deck'] == True:
|
|
326
|
+ # own['requestAction'] = 'fak_walk_nb'
|
|
327
|
+ # else:
|
|
328
|
+ # own['requestAction'] = 'fak_walk'
|
327
|
329
|
|
328
|
|
- elif (((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 1):
|
329
|
|
- own.actuators["walkondirt"].volume = .2
|
330
|
|
- #own.actuators["walkondirt"].pitch = 1.3
|
331
|
|
- own.actuators["walkondirt"].pitch = 2
|
332
|
|
- cont.activate(own.actuators["walkondirt"])
|
333
|
|
- #print('fastwalk')
|
334
|
|
- if stance == 0 and skater.isPlayingAction(fliplay) == False:
|
335
|
|
- if own['throw_deck'] == True:
|
336
|
|
- own['requestAction'] = 'reg_walkFast_nb'
|
337
|
|
- else:
|
338
|
|
- own['requestAction'] = 'reg_walkFast'
|
|
330
|
+ # elif (((lup == 1 and aBut == 1) or (dict['kb_lsh'] == 2 and dict['kb_ua'] == 2)) and yBut == False and (r_ground.positive or own['stair_counter'] > 0) and xBut == 0) or (turning == True and aBut == 1):
|
|
331
|
+ # own.actuators["walkondirt"].volume = .2
|
|
332
|
+ # #own.actuators["walkondirt"].pitch = 1.3
|
|
333
|
+ # own.actuators["walkondirt"].pitch = 2
|
|
334
|
+ # cont.activate(own.actuators["walkondirt"])
|
|
335
|
+ # #print('fastwalk')
|
|
336
|
+ # if stance == 0 and skater.isPlayingAction(fliplay) == False:
|
|
337
|
+ # if own['throw_deck'] == True:
|
|
338
|
+ # own['requestAction'] = 'reg_walkFast_nb'
|
|
339
|
+ # else:
|
|
340
|
+ # own['requestAction'] = 'reg_walkFast'
|
339
|
341
|
|
340
|
|
- if stance == 1 and skater.isPlayingAction(fliplay) == False:
|
341
|
|
- if own['throw_deck'] == True:
|
342
|
|
- own['requestAction'] = 'fak_walkFast_nb'
|
343
|
|
- else:
|
344
|
|
- own['requestAction'] = 'fak_walkFast'
|
345
|
|
- else:
|
346
|
|
- vel = own.getLinearVelocity(True)
|
347
|
|
- cont.deactivate(own.actuators["walkondirt"])
|
|
342
|
+ # if stance == 1 and skater.isPlayingAction(fliplay) == False:
|
|
343
|
+ # if own['throw_deck'] == True:
|
|
344
|
+ # own['requestAction'] = 'fak_walkFast_nb'
|
|
345
|
+ # else:
|
|
346
|
+ # own['requestAction'] = 'fak_walkFast'
|
|
347
|
+ # else:
|
|
348
|
+ # vel = own.getLinearVelocity(True)
|
|
349
|
+ # cont.deactivate(own.actuators["walkondirt"])
|
348
|
350
|
|
349
|
351
|
|
350
|
|
- #---------------
|
351
|
|
- if rLR > .05:
|
352
|
|
- cont.activate(camobj.actuators['camRight'])
|
353
|
|
- else:
|
354
|
|
- cont.deactivate(camobj.actuators['camRight'])
|
355
|
|
- if rLR < -.05:
|
356
|
|
- cont.activate(camobj.actuators['camLeft'])
|
357
|
|
- else:
|
358
|
|
- cont.deactivate(camobj.actuators['camLeft'])
|
359
|
|
- if rUD > .05:
|
360
|
|
- cont.activate(camobj.actuators['camDown'])
|
361
|
|
- else:
|
362
|
|
- cont.deactivate(camobj.actuators['camDown'])
|
363
|
|
- if rUD < -.05:
|
364
|
|
- cont.activate(camobj.actuators['camUp'])
|
365
|
|
- else:
|
366
|
|
- cont.deactivate(camobj.actuators['camUp'])
|
|
352
|
+ # #---------------
|
|
353
|
+ # if rLR > .05:
|
|
354
|
+ # cont.activate(camobj.actuators['camRight'])
|
|
355
|
+ # else:
|
|
356
|
+ # cont.deactivate(camobj.actuators['camRight'])
|
|
357
|
+ # if rLR < -.05:
|
|
358
|
+ # cont.activate(camobj.actuators['camLeft'])
|
|
359
|
+ # else:
|
|
360
|
+ # cont.deactivate(camobj.actuators['camLeft'])
|
|
361
|
+ # if rUD > .05:
|
|
362
|
+ # cont.activate(camobj.actuators['camDown'])
|
|
363
|
+ # else:
|
|
364
|
+ # cont.deactivate(camobj.actuators['camDown'])
|
|
365
|
+ # if rUD < -.05:
|
|
366
|
+ # cont.activate(camobj.actuators['camUp'])
|
|
367
|
+ # else:
|
|
368
|
+ # cont.deactivate(camobj.actuators['camUp'])
|
367
|
369
|
|
368
|
|
- #----------------
|
369
|
|
- #camera.height = .01 #.9
|
370
|
|
- #camera.min = 1.75
|
371
|
|
- #camera.max = 2.25
|
372
|
|
- lasty = own['lasty']
|
|
370
|
+ # #----------------
|
|
371
|
+ # #camera.height = .01 #.9
|
|
372
|
+ # #camera.min = 1.75
|
|
373
|
+ # #camera.max = 2.25
|
|
374
|
+ # lasty = own['lasty']
|
373
|
375
|
|
374
|
|
- def onboard():
|
375
|
|
- if own['walk'] == 0:
|
376
|
|
- print("start walking")
|
377
|
|
- own['walk_idling'] = 0
|
378
|
|
- if own['framenum'] > 100 and own['fall'] == False:
|
379
|
|
- #cont.activate(own.actuators['pop'])
|
380
|
|
- camobj['sndmgr'].queue_sound(['pop', cube, camobj])
|
381
|
|
- own['getoffboard'] = False
|
382
|
|
- own["walk_idle_frame"] = own["framenum"]
|
383
|
|
- own['grindcement_vol'] = 0
|
384
|
|
- own['grindcement_pitch'] = 0
|
385
|
|
- own['grindrail_vol'] = 0
|
386
|
|
- own['grindrail_pitch'] = 0
|
387
|
|
- own['sroll_vol'] = 0
|
388
|
|
- own['sroll_pitch'] = 0
|
|
376
|
+ # def onboard():
|
|
377
|
+ # if own['walk'] == 0:
|
|
378
|
+ # print("start walking")
|
|
379
|
+ # own['walk_idling'] = 0
|
|
380
|
+ # if own['framenum'] > 100 and own['fall'] == False:
|
|
381
|
+ # #cont.activate(own.actuators['pop'])
|
|
382
|
+ # camobj['sndmgr'].queue_sound(['pop', cube, camobj])
|
|
383
|
+ # own['getoffboard'] = False
|
|
384
|
+ # own["walk_idle_frame"] = own["framenum"]
|
|
385
|
+ # own['grindcement_vol'] = 0
|
|
386
|
+ # own['grindcement_pitch'] = 0
|
|
387
|
+ # own['grindrail_vol'] = 0
|
|
388
|
+ # own['grindrail_pitch'] = 0
|
|
389
|
+ # own['sroll_vol'] = 0
|
|
390
|
+ # own['sroll_pitch'] = 0
|
389
|
391
|
|
390
|
392
|
|
391
|
|
- #camobj.worldPosition.z += 4
|
392
|
|
- try:
|
393
|
|
- vel = own['offboard_vel']
|
394
|
|
- vel = [velx, vel.y, vel.z]
|
395
|
|
- except:
|
396
|
|
- pass
|
|
393
|
+ # #camobj.worldPosition.z += 4
|
|
394
|
+ # try:
|
|
395
|
+ # vel = own['offboard_vel']
|
|
396
|
+ # vel = [velx, vel.y, vel.z]
|
|
397
|
+ # except:
|
|
398
|
+ # pass
|
397
|
399
|
|
398
|
|
- if STANCE == 0:
|
399
|
|
- #own['requestAction'] = 'reg_offboard'
|
400
|
|
- print('requesting off board')
|
|
400
|
+ # if STANCE == 0:
|
|
401
|
+ # #own['requestAction'] = 'reg_offboard'
|
|
402
|
+ # print('requesting off board')
|
401
|
403
|
|
402
|
|
- #if STANCE == 1:
|
403
|
|
- #own['requestAction'] = 'fak_offboard'
|
404
|
|
- def jump():
|
405
|
|
- pass
|
406
|
|
- # #limit fall speed
|
407
|
|
- # if linvel.z < -10:
|
408
|
|
- # own.linearVelocity.z = -10
|
409
|
|
- # if xBut == True or dict['kb_space'] == 1:
|
410
|
|
- # if own['lastx'] == 0:
|
411
|
|
- # #killact(3)
|
412
|
|
- # #killact(4)
|
413
|
|
- # #killact(5)
|
414
|
|
- # #killact(6)
|
415
|
|
- # #killact(7)
|
416
|
|
- # if STANCE == 0:
|
417
|
|
- # own['requestAction'] ='reg_jump'
|
418
|
|
- # #print('jump')
|
419
|
|
- # if STANCE == 1:
|
420
|
|
- # own['requestAction'] ='fak_jump'
|
421
|
|
- # #print('jump')
|
422
|
|
- # JUMPHEIGHT = 1100
|
423
|
|
- # force = [ 0.0, 0.0, JUMPHEIGHT]
|
424
|
|
- # # use local axis
|
425
|
|
- # local = False
|
426
|
|
- # # apply force -- limit jump speed
|
427
|
|
- # if linvel.z < 10:
|
428
|
|
- # #own.applyForce(force, local)
|
429
|
|
- # own.linearVelocity.z += 5
|
430
|
|
- # own.linearVelocity.x = linvel.x
|
431
|
|
- # own.linearVelocity.y = linvel.y
|
432
|
|
- # own['walk_jump_timer'] = 6
|
433
|
|
- # own['lastx'] = 1
|
434
|
|
- # else:
|
435
|
|
- # own['lastx'] = 0
|
|
404
|
+ # #if STANCE == 1:
|
|
405
|
+ # #own['requestAction'] = 'fak_offboard'
|
|
406
|
+ # def jump():
|
|
407
|
+ # pass
|
|
408
|
+ # # #limit fall speed
|
|
409
|
+ # # if linvel.z < -10:
|
|
410
|
+ # # own.linearVelocity.z = -10
|
|
411
|
+ # # if xBut == True or dict['kb_space'] == 1:
|
|
412
|
+ # # if own['lastx'] == 0:
|
|
413
|
+ # # #killact(3)
|
|
414
|
+ # # #killact(4)
|
|
415
|
+ # # #killact(5)
|
|
416
|
+ # # #killact(6)
|
|
417
|
+ # # #killact(7)
|
|
418
|
+ # # if STANCE == 0:
|
|
419
|
+ # # own['requestAction'] ='reg_jump'
|
|
420
|
+ # # #print('jump')
|
|
421
|
+ # # if STANCE == 1:
|
|
422
|
+ # # own['requestAction'] ='fak_jump'
|
|
423
|
+ # # #print('jump')
|
|
424
|
+ # # JUMPHEIGHT = 1100
|
|
425
|
+ # # force = [ 0.0, 0.0, JUMPHEIGHT]
|
|
426
|
+ # # # use local axis
|
|
427
|
+ # # local = False
|
|
428
|
+ # # # apply force -- limit jump speed
|
|
429
|
+ # # if linvel.z < 10:
|
|
430
|
+ # # #own.applyForce(force, local)
|
|
431
|
+ # # own.linearVelocity.z += 5
|
|
432
|
+ # # own.linearVelocity.x = linvel.x
|
|
433
|
+ # # own.linearVelocity.y = linvel.y
|
|
434
|
+ # # own['walk_jump_timer'] = 6
|
|
435
|
+ # # own['lastx'] = 1
|
|
436
|
+ # # else:
|
|
437
|
+ # # own['lastx'] = 0
|
436
|
438
|
|
437
|
|
- def getonboard(dict, cont):
|
438
|
|
- grindDar = cont.sensors['grindDar2']
|
439
|
|
- getonboard = own['getonboard']
|
440
|
|
- fliplay2 = 50#8560
|
441
|
|
- if ((yBut == True and dict['last_yBut'] == False) or dict['kb_q'] == 2):# and (cont.sensors["vehicleNear"].positive == False and own['throw_deck'] == False):
|
442
|
|
- fliplay3 = fliplay2 + 1
|
443
|
|
- dar = 0
|
444
|
|
- if grindDar.hitObjectList != None:
|
445
|
|
- for x in grindDar.hitObjectList:
|
446
|
|
- to_grinder = (x.worldPosition - own.worldPosition).length
|
447
|
|
- #if 'coping' in x and to_grinder < .36:
|
448
|
|
- if 'coping' in x:
|
449
|
|
- dar = 1
|
450
|
|
- if dropinCol.positive == True or dar == 1:
|
451
|
|
- nearestObject = None
|
452
|
|
- grindEmpty = scene.objects['grindEmpty']
|
453
|
|
- grindDar = grindEmpty.sensors['grindDar2']
|
454
|
|
- minDist = None
|
455
|
|
- if grindDar.positive:
|
456
|
|
- detectedObjects = grindDar.hitObjectList
|
457
|
|
- dist = 0
|
458
|
|
- for obj in detectedObjects:
|
459
|
|
- dist = own.getDistanceTo(obj)
|
460
|
|
- if (minDist is None or dist < minDist):
|
461
|
|
- nearestObject = obj
|
462
|
|
- minDist = dist
|
|
439
|
+ # def getonboard(dict, cont):
|
|
440
|
+ # grindDar = cont.sensors['grindDar2']
|
|
441
|
+ # getonboard = own['getonboard']
|
|
442
|
+ # fliplay2 = 50#8560
|
|
443
|
+ # if ((yBut == True and dict['last_yBut'] == False) or dict['kb_q'] == 2):# and (cont.sensors["vehicleNear"].positive == False and own['throw_deck'] == False):
|
|
444
|
+ # fliplay3 = fliplay2 + 1
|
|
445
|
+ # dar = 0
|
|
446
|
+ # if grindDar.hitObjectList != None:
|
|
447
|
+ # for x in grindDar.hitObjectList:
|
|
448
|
+ # to_grinder = (x.worldPosition - own.worldPosition).length
|
|
449
|
+ # #if 'coping' in x and to_grinder < .36:
|
|
450
|
+ # if 'coping' in x:
|
|
451
|
+ # dar = 1
|
|
452
|
+ # if dropinCol.positive == True or dar == 1:
|
|
453
|
+ # nearestObject = None
|
|
454
|
+ # grindEmpty = scene.objects['grindEmpty']
|
|
455
|
+ # grindDar = grindEmpty.sensors['grindDar2']
|
|
456
|
+ # minDist = None
|
|
457
|
+ # if grindDar.positive:
|
|
458
|
+ # detectedObjects = grindDar.hitObjectList
|
|
459
|
+ # dist = 0
|
|
460
|
+ # for obj in detectedObjects:
|
|
461
|
+ # dist = own.getDistanceTo(obj)
|
|
462
|
+ # if (minDist is None or dist < minDist):
|
|
463
|
+ # nearestObject = obj
|
|
464
|
+ # minDist = dist
|
463
|
465
|
|
464
|
|
- print('dropin')
|
465
|
|
- if STANCE == 0:
|
466
|
|
- own['requestAction'] ='reg_dropin'
|
467
|
|
- own['dropinTimer'] = 60
|
|
466
|
+ # print('dropin')
|
|
467
|
+ # if STANCE == 0:
|
|
468
|
+ # own['requestAction'] ='reg_dropin'
|
|
469
|
+ # own['dropinTimer'] = 60
|
468
|
470
|
|
469
|
|
- if STANCE == 1:
|
470
|
|
- own['requestAction'] ='fak_dropin'
|
471
|
|
- own['dropinTimer'] = 60
|
|
471
|
+ # if STANCE == 1:
|
|
472
|
+ # own['requestAction'] ='fak_dropin'
|
|
473
|
+ # own['dropinTimer'] = 60
|
472
|
474
|
|
473
|
|
- if getonboard == 1:
|
474
|
|
- fliplay3 = 6000
|
475
|
|
- onboard_speed = .1
|
476
|
|
- own['getonboard'] = 0
|
477
|
|
- own['walk_idling'] = 0
|
478
|
|
- if (yBut == False and lasty == True) or (yBut == True or dict['kb_q'] == 3) and dropinCol.positive:
|
479
|
|
- print('getting on board')
|
480
|
|
- deckact = deck.actuators["Visibility"]
|
481
|
|
- trucksact = trucks.actuators["Visibility"]
|
482
|
|
- wheel1act = wheel1.actuators["Visibility"]
|
483
|
|
- wheel2act = wheel2.actuators["Visibility"]
|
484
|
|
- wheel3act = wheel3.actuators["Visibility"]
|
485
|
|
- wheel4act = wheel4.actuators["Visibility"]
|
486
|
|
- deckact.visibility = True
|
487
|
|
- trucksact.visibility = True
|
488
|
|
- wheel1act.visibility = True
|
489
|
|
- wheel2act.visibility = True
|
490
|
|
- wheel3act.visibility = True
|
491
|
|
- wheel4act.visibility = True
|
492
|
|
- cont.activate(deck.actuators['Visibility'])
|
493
|
|
- cont.activate(trucks.actuators['Visibility'])
|
494
|
|
- cont.activate(wheel1.actuators['Visibility'])
|
495
|
|
- cont.activate(wheel2.actuators['Visibility'])
|
496
|
|
- cont.activate(wheel3.actuators['Visibility'])
|
497
|
|
- cont.activate(wheel4.actuators['Visibility'])
|
498
|
|
- own['throw_deck'] = False
|
499
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
500
|
|
- throw_deck_empty['kill_deck'] = 1
|
501
|
|
- if ((yBut == False and lasty == True) or dict['kb_q'] == 3):# and cont.sensors["vehicleNear"].positive == False:
|
502
|
|
- print('secondary get on board')
|
503
|
|
- own['getonboard'] = 1
|
504
|
|
- own['walk_idling'] = 0
|
505
|
|
- deckact = deck.actuators["Visibility"]
|
506
|
|
- trucksact = trucks.actuators["Visibility"]
|
507
|
|
- wheel1act = wheel1.actuators["Visibility"]
|
508
|
|
- wheel2act = wheel2.actuators["Visibility"]
|
509
|
|
- wheel3act = wheel3.actuators["Visibility"]
|
510
|
|
- wheel4act = wheel4.actuators["Visibility"]
|
511
|
|
- deckact.visibility = True
|
512
|
|
- trucksact.visibility = True
|
513
|
|
- wheel1act.visibility = True
|
514
|
|
- wheel2act.visibility = True
|
515
|
|
- wheel3act.visibility = True
|
516
|
|
- wheel4act.visibility = True
|
517
|
|
- cont.activate(deck.actuators['Visibility'])
|
518
|
|
- cont.activate(trucks.actuators['Visibility'])
|
519
|
|
- cont.activate(wheel1.actuators['Visibility'])
|
520
|
|
- cont.activate(wheel2.actuators['Visibility'])
|
521
|
|
- cont.activate(wheel3.actuators['Visibility'])
|
522
|
|
- cont.activate(wheel4.actuators['Visibility'])
|
523
|
|
- own['throw_deck'] = False
|
524
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
525
|
|
- throw_deck_empty['kill_deck'] = 1
|
|
475
|
+ # if getonboard == 1:
|
|
476
|
+ # fliplay3 = 6000
|
|
477
|
+ # onboard_speed = .1
|
|
478
|
+ # own['getonboard'] = 0
|
|
479
|
+ # own['walk_idling'] = 0
|
|
480
|
+ # if (yBut == False and lasty == True) or (yBut == True or dict['kb_q'] == 3) and dropinCol.positive:
|
|
481
|
+ # print('getting on board')
|
|
482
|
+ # deckact = deck.actuators["Visibility"]
|
|
483
|
+ # trucksact = trucks.actuators["Visibility"]
|
|
484
|
+ # wheel1act = wheel1.actuators["Visibility"]
|
|
485
|
+ # wheel2act = wheel2.actuators["Visibility"]
|
|
486
|
+ # wheel3act = wheel3.actuators["Visibility"]
|
|
487
|
+ # wheel4act = wheel4.actuators["Visibility"]
|
|
488
|
+ # deckact.visibility = True
|
|
489
|
+ # trucksact.visibility = True
|
|
490
|
+ # wheel1act.visibility = True
|
|
491
|
+ # wheel2act.visibility = True
|
|
492
|
+ # wheel3act.visibility = True
|
|
493
|
+ # wheel4act.visibility = True
|
|
494
|
+ # cont.activate(deck.actuators['Visibility'])
|
|
495
|
+ # cont.activate(trucks.actuators['Visibility'])
|
|
496
|
+ # cont.activate(wheel1.actuators['Visibility'])
|
|
497
|
+ # cont.activate(wheel2.actuators['Visibility'])
|
|
498
|
+ # cont.activate(wheel3.actuators['Visibility'])
|
|
499
|
+ # cont.activate(wheel4.actuators['Visibility'])
|
|
500
|
+ # own['throw_deck'] = False
|
|
501
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
502
|
+ # throw_deck_empty['kill_deck'] = 1
|
|
503
|
+ # if ((yBut == False and lasty == True) or dict['kb_q'] == 3):# and cont.sensors["vehicleNear"].positive == False:
|
|
504
|
+ # print('secondary get on board')
|
|
505
|
+ # own['getonboard'] = 1
|
|
506
|
+ # own['walk_idling'] = 0
|
|
507
|
+ # deckact = deck.actuators["Visibility"]
|
|
508
|
+ # trucksact = trucks.actuators["Visibility"]
|
|
509
|
+ # wheel1act = wheel1.actuators["Visibility"]
|
|
510
|
+ # wheel2act = wheel2.actuators["Visibility"]
|
|
511
|
+ # wheel3act = wheel3.actuators["Visibility"]
|
|
512
|
+ # wheel4act = wheel4.actuators["Visibility"]
|
|
513
|
+ # deckact.visibility = True
|
|
514
|
+ # trucksact.visibility = True
|
|
515
|
+ # wheel1act.visibility = True
|
|
516
|
+ # wheel2act.visibility = True
|
|
517
|
+ # wheel3act.visibility = True
|
|
518
|
+ # wheel4act.visibility = True
|
|
519
|
+ # cont.activate(deck.actuators['Visibility'])
|
|
520
|
+ # cont.activate(trucks.actuators['Visibility'])
|
|
521
|
+ # cont.activate(wheel1.actuators['Visibility'])
|
|
522
|
+ # cont.activate(wheel2.actuators['Visibility'])
|
|
523
|
+ # cont.activate(wheel3.actuators['Visibility'])
|
|
524
|
+ # cont.activate(wheel4.actuators['Visibility'])
|
|
525
|
+ # own['throw_deck'] = False
|
|
526
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
527
|
+ # throw_deck_empty['kill_deck'] = 1
|
526
|
528
|
|
527
|
529
|
|
528
|
530
|
|
529
|
|
- def nextframe():
|
530
|
|
- framenumber = own["framenum"]
|
531
|
|
- framenumber = framenumber + 1
|
532
|
|
- if framenumber == 900000:
|
533
|
|
- framenumber = 0
|
534
|
|
- own["framenum"] = framenumber
|
535
|
|
- own['last_walk_frame'] = framenumber
|
|
531
|
+ # def nextframe():
|
|
532
|
+ # framenumber = own["framenum"]
|
|
533
|
+ # framenumber = framenumber + 1
|
|
534
|
+ # if framenumber == 900000:
|
|
535
|
+ # framenumber = 0
|
|
536
|
+ # own["framenum"] = framenumber
|
|
537
|
+ # own['last_walk_frame'] = framenumber
|
536
|
538
|
|
537
|
|
- def checkidle():
|
538
|
|
- idle = cont.sensors["idle"]
|
539
|
|
- idle_frame = own["walk_idle_frame"]
|
540
|
|
- if idle.positive:
|
541
|
|
- own["walk_idle_frame"] = 0
|
542
|
|
- cont.deactivate(camobj.actuators['idle_camRight'])
|
543
|
|
- #camera.height = .5
|
544
|
|
- camera.height = dict['cam_idle_height']
|
545
|
|
- else:
|
546
|
|
- if idle_frame == 0:
|
547
|
|
- own["walk_idle_frame"] = own["framenum"]
|
548
|
|
- diff = own["framenum"] - idle_frame
|
|
539
|
+ # def checkidle():
|
|
540
|
+ # idle = cont.sensors["idle"]
|
|
541
|
+ # idle_frame = own["walk_idle_frame"]
|
|
542
|
+ # if idle.positive:
|
|
543
|
+ # own["walk_idle_frame"] = 0
|
|
544
|
+ # cont.deactivate(camobj.actuators['idle_camRight'])
|
|
545
|
+ # #camera.height = .5
|
|
546
|
+ # camera.height = dict['cam_idle_height']
|
|
547
|
+ # else:
|
|
548
|
+ # if idle_frame == 0:
|
|
549
|
+ # own["walk_idle_frame"] = own["framenum"]
|
|
550
|
+ # diff = own["framenum"] - idle_frame
|
549
|
551
|
|
550
|
|
- if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
|
551
|
|
- cont.activate(camobj.actuators['idle_camRight'])
|
552
|
|
- #camera.height = .9
|
553
|
|
- #camera.min = 2
|
554
|
|
- #camera.max = 2.50
|
555
|
|
- own['walk_idling'] = 1
|
556
|
|
- else:
|
557
|
|
- own['walk_idling'] = 0
|
|
552
|
+ # if (diff > 700 and idle_frame != 0 and dropinCol.positive == False and own['walk'] != 0) or own['sit'] == 1:
|
|
553
|
+ # cont.activate(camobj.actuators['idle_camRight'])
|
|
554
|
+ # #camera.height = .9
|
|
555
|
+ # #camera.min = 2
|
|
556
|
+ # #camera.max = 2.50
|
|
557
|
+ # own['walk_idling'] = 1
|
|
558
|
+ # else:
|
|
559
|
+ # own['walk_idling'] = 0
|
558
|
560
|
|
559
|
|
- def idle_anim():
|
560
|
|
- if own['walk_idling'] == 1 and own['sit'] == 0:
|
561
|
|
- walk_idle_frame = own['walk_idle_frame']
|
562
|
|
- mod_num = (own["framenum"] - walk_idle_frame) % 240
|
563
|
|
- idle_lay = 300
|
564
|
|
- if mod_num == 0:
|
565
|
|
- if own['idle_skipper'] > 0:
|
566
|
|
- own['idle_skipper'] -= 1
|
567
|
|
- ran_num = random.randint(1, 8)
|
568
|
|
- if own['last_idle_num'] == ran_num:
|
569
|
|
- ran_num = 1
|
570
|
|
- if own['idle_skipper'] == 0:
|
571
|
|
- own['last_idle_num'] = ran_num
|
572
|
|
- if ran_num == 1 or ran_num > 7:
|
573
|
|
- killact(3)
|
574
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
575
|
|
- own['requestAction'] = 'reg_idle1'
|
576
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
577
|
|
- own['requestAction'] = 'reg_idle1'
|
578
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
579
|
|
- own['requestAction'] = 'fak_idle1'
|
580
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
581
|
|
- own['requestAction'] = 'fak_idle1'
|
|
561
|
+ # def idle_anim():
|
|
562
|
+ # if own['walk_idling'] == 1 and own['sit'] == 0:
|
|
563
|
+ # walk_idle_frame = own['walk_idle_frame']
|
|
564
|
+ # mod_num = (own["framenum"] - walk_idle_frame) % 240
|
|
565
|
+ # idle_lay = 300
|
|
566
|
+ # if mod_num == 0:
|
|
567
|
+ # if own['idle_skipper'] > 0:
|
|
568
|
+ # own['idle_skipper'] -= 1
|
|
569
|
+ # ran_num = random.randint(1, 8)
|
|
570
|
+ # if own['last_idle_num'] == ran_num:
|
|
571
|
+ # ran_num = 1
|
|
572
|
+ # if own['idle_skipper'] == 0:
|
|
573
|
+ # own['last_idle_num'] = ran_num
|
|
574
|
+ # if ran_num == 1 or ran_num > 7:
|
|
575
|
+ # killact(3)
|
|
576
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
577
|
+ # own['requestAction'] = 'reg_idle1'
|
|
578
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
579
|
+ # own['requestAction'] = 'reg_idle1'
|
|
580
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
581
|
+ # own['requestAction'] = 'fak_idle1'
|
|
582
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
583
|
+ # own['requestAction'] = 'fak_idle1'
|
582
|
584
|
|
583
|
|
- elif ran_num == 2:
|
584
|
|
- killact(3)
|
585
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
586
|
|
- own['requestAction'] = 'reg_idle2'
|
587
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
588
|
|
- own['requestAction'] = 'reg_idle2_nb'
|
589
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
590
|
|
- own['requestAction'] = 'fak_idle1'
|
591
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
592
|
|
- own['requestAction'] = 'fak_idle1'
|
593
|
|
- elif ran_num == 3:
|
594
|
|
- killact(3)
|
595
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
596
|
|
- own['requestAction'] = 'reg_idle3'
|
597
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
598
|
|
- own['requestAction'] = 'reg_idle3'
|
599
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
600
|
|
- own['requestAction'] = 'fak_idle1'
|
601
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
602
|
|
- own['requestAction'] = 'fak_idle1'
|
603
|
|
- own['idle_skipper'] = 2
|
604
|
|
- elif ran_num == 4:
|
605
|
|
- killact(3)
|
606
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
607
|
|
- own['requestAction'] = 'reg_idle4'
|
608
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
609
|
|
- own['requestAction'] = 'reg_idle4'
|
610
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
611
|
|
- own['requestAction'] = 'fak_idle4'
|
612
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
613
|
|
- own['requestAction'] = 'fak_idle4'
|
614
|
|
- elif ran_num == 5:
|
615
|
|
- killact(3)
|
616
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
617
|
|
- own['requestAction'] = 'reg_idle5'
|
618
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
619
|
|
- own['requestAction'] = 'reg_idle5'
|
620
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
621
|
|
- own['requestAction'] = 'fak_idle5'
|
622
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
623
|
|
- own['requestAction'] = 'fak_idle5'
|
624
|
|
- elif ran_num == 6:
|
625
|
|
- killact(3)
|
626
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
627
|
|
- own['requestAction'] = 'reg_idle6'
|
628
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
629
|
|
- own['requestAction'] = 'reg_idle6'
|
630
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
631
|
|
- own['requestAction'] = 'fak_idle6'
|
632
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
633
|
|
- own['requestAction'] = 'fak_idle6'
|
634
|
|
- elif ran_num == 7:
|
635
|
|
- killact(3)
|
636
|
|
- if STANCE == 0 and own['throw_deck'] == 0:
|
637
|
|
- own['requestAction'] = 'reg_idle7'
|
638
|
|
- elif STANCE == 0 and own['throw_deck'] == 1:
|
639
|
|
- own['requestAction'] = 'reg_idle7'
|
640
|
|
- elif STANCE == 1 and own['throw_deck'] == 0:
|
641
|
|
- own['requestAction'] = 'fak_idle6'
|
642
|
|
- elif STANCE == 1 and own['throw_deck'] == 1:
|
643
|
|
- own['requestAction'] = 'fak_idle6'
|
|
585
|
+ # elif ran_num == 2:
|
|
586
|
+ # killact(3)
|
|
587
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
588
|
+ # own['requestAction'] = 'reg_idle2'
|
|
589
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
590
|
+ # own['requestAction'] = 'reg_idle2_nb'
|
|
591
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
592
|
+ # own['requestAction'] = 'fak_idle1'
|
|
593
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
594
|
+ # own['requestAction'] = 'fak_idle1'
|
|
595
|
+ # elif ran_num == 3:
|
|
596
|
+ # killact(3)
|
|
597
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
598
|
+ # own['requestAction'] = 'reg_idle3'
|
|
599
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
600
|
+ # own['requestAction'] = 'reg_idle3'
|
|
601
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
602
|
+ # own['requestAction'] = 'fak_idle1'
|
|
603
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
604
|
+ # own['requestAction'] = 'fak_idle1'
|
|
605
|
+ # own['idle_skipper'] = 2
|
|
606
|
+ # elif ran_num == 4:
|
|
607
|
+ # killact(3)
|
|
608
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
609
|
+ # own['requestAction'] = 'reg_idle4'
|
|
610
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
611
|
+ # own['requestAction'] = 'reg_idle4'
|
|
612
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
613
|
+ # own['requestAction'] = 'fak_idle4'
|
|
614
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
615
|
+ # own['requestAction'] = 'fak_idle4'
|
|
616
|
+ # elif ran_num == 5:
|
|
617
|
+ # killact(3)
|
|
618
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
619
|
+ # own['requestAction'] = 'reg_idle5'
|
|
620
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
621
|
+ # own['requestAction'] = 'reg_idle5'
|
|
622
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
623
|
+ # own['requestAction'] = 'fak_idle5'
|
|
624
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
625
|
+ # own['requestAction'] = 'fak_idle5'
|
|
626
|
+ # elif ran_num == 6:
|
|
627
|
+ # killact(3)
|
|
628
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
629
|
+ # own['requestAction'] = 'reg_idle6'
|
|
630
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
631
|
+ # own['requestAction'] = 'reg_idle6'
|
|
632
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
633
|
+ # own['requestAction'] = 'fak_idle6'
|
|
634
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
635
|
+ # own['requestAction'] = 'fak_idle6'
|
|
636
|
+ # elif ran_num == 7:
|
|
637
|
+ # killact(3)
|
|
638
|
+ # if STANCE == 0 and own['throw_deck'] == 0:
|
|
639
|
+ # own['requestAction'] = 'reg_idle7'
|
|
640
|
+ # elif STANCE == 0 and own['throw_deck'] == 1:
|
|
641
|
+ # own['requestAction'] = 'reg_idle7'
|
|
642
|
+ # elif STANCE == 1 and own['throw_deck'] == 0:
|
|
643
|
+ # own['requestAction'] = 'fak_idle6'
|
|
644
|
+ # elif STANCE == 1 and own['throw_deck'] == 1:
|
|
645
|
+ # own['requestAction'] = 'fak_idle6'
|
644
|
646
|
|
645
|
|
- def reset_pos():
|
646
|
|
- #reset
|
647
|
|
- if ddPad == 1:
|
648
|
|
- spawn_pos = own['spawn_pos']
|
649
|
|
- spawn_rot = own['spawn_rot']
|
650
|
|
- spawn_cam_pos = own['spawn_cam_pos']
|
651
|
|
- spawn_cam_rot = own['spawn_cam_rot']
|
652
|
|
- try:
|
653
|
|
- own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
|
654
|
|
- own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
|
655
|
|
- cam.worldPosition = (spawn_cam_pos[0], spawn_cam_pos[1], (spawn_cam_pos[2]))
|
656
|
|
- cam.worldOrientation = [[spawn_cam_rot[0][0],spawn_cam_rot[0][1],spawn_cam_rot[0][2]], [spawn_cam_rot[1][0],spawn_cam_rot[1][1],spawn_cam_rot[1][2]], [0.0, 0.0, 1.0]]
|
657
|
|
- except:
|
658
|
|
- own.worldPosition = (5, 2, .1)
|
659
|
|
- own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
|
660
|
|
- own['stance'] = own['spawn_stance']
|
661
|
|
- if own["spawn_stance"] == 1:
|
662
|
|
- own.setLinearVelocity([.1,0,0], 1)
|
663
|
|
- else:
|
664
|
|
- own.setLinearVelocity([-.1,0,0], 1)
|
|
647
|
+ # def reset_pos():
|
|
648
|
+ # #reset
|
|
649
|
+ # if ddPad == 1:
|
|
650
|
+ # spawn_pos = own['spawn_pos']
|
|
651
|
+ # spawn_rot = own['spawn_rot']
|
|
652
|
+ # spawn_cam_pos = own['spawn_cam_pos']
|
|
653
|
+ # spawn_cam_rot = own['spawn_cam_rot']
|
|
654
|
+ # try:
|
|
655
|
+ # own.worldPosition = (spawn_pos[0], spawn_pos[1], (spawn_pos[2] + .1))
|
|
656
|
+ # own.worldOrientation = [[spawn_rot[0][0],spawn_rot[0][1],spawn_rot[0][2]], [spawn_rot[1][0],spawn_rot[1][1],spawn_rot[1][2]], [0.0, 0.0, 1.0]]
|
|
657
|
+ # cam.worldPosition = (spawn_cam_pos[0], spawn_cam_pos[1], (spawn_cam_pos[2]))
|
|
658
|
+ # cam.worldOrientation = [[spawn_cam_rot[0][0],spawn_cam_rot[0][1],spawn_cam_rot[0][2]], [spawn_cam_rot[1][0],spawn_cam_rot[1][1],spawn_cam_rot[1][2]], [0.0, 0.0, 1.0]]
|
|
659
|
+ # except:
|
|
660
|
+ # own.worldPosition = (5, 2, .1)
|
|
661
|
+ # own.worldOrientation = [[1.0, 0.0, 0.0], [ 0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
|
|
662
|
+ # own['stance'] = own['spawn_stance']
|
|
663
|
+ # if own["spawn_stance"] == 1:
|
|
664
|
+ # own.setLinearVelocity([.1,0,0], 1)
|
|
665
|
+ # else:
|
|
666
|
+ # own.setLinearVelocity([-.1,0,0], 1)
|
665
|
667
|
|
666
|
|
- if udPad == 1:
|
667
|
|
- own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
|
668
|
|
- own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
|
669
|
|
- own['spawn_cam_pos'] = [cam.worldPosition[0], cam.worldPosition[1], cam.worldPosition[2]]
|
670
|
|
- own['spawn_cam_rot'] = [[cam.worldOrientation[0][0],cam.worldOrientation[0][1],cam.worldOrientation[0][2]], [cam.worldOrientation[1][0],cam.worldOrientation[1][1],cam.worldOrientation[1][2]], cam.worldOrientation[2][2]]
|
671
|
|
- stance = own["stance"]
|
672
|
|
- own["spawn_stance"] = stance
|
673
|
|
- def falldeck():
|
674
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
675
|
|
- throw_deck_empty.worldPosition.y += .5
|
676
|
|
- throw_deck_empty.worldPosition.x += .5
|
677
|
|
- deckact = deck.actuators["Visibility"]
|
678
|
|
- trucksact = trucks.actuators["Visibility"]
|
679
|
|
- wheel1act = wheel1.actuators["Visibility"]
|
680
|
|
- wheel2act = wheel2.actuators["Visibility"]
|
681
|
|
- wheel3act = wheel3.actuators["Visibility"]
|
682
|
|
- wheel4act = wheel4.actuators["Visibility"]
|
683
|
|
- print('doing falldeck')
|
684
|
|
- if own['throw_deck'] == False:
|
685
|
|
- own['throw_deck'] = True
|
686
|
|
- deckact.visibility = False
|
687
|
|
- trucksact.visibility = False
|
688
|
|
- wheel1act.visibility = False
|
689
|
|
- wheel2act.visibility = False
|
690
|
|
- wheel3act.visibility = False
|
691
|
|
- wheel4act.visibility = False
|
692
|
|
- act = throw_deck_empty.actuators['throw_dec_act']
|
693
|
|
- if STANCE == True:
|
694
|
|
- act.linearVelocity = [0.0, 1.0, 1.0]
|
695
|
|
- if STANCE == False:
|
696
|
|
- act.linearVelocity = [0.0, 1.0, -1.0]
|
697
|
|
- cont.activate(act)
|
698
|
|
- print('running falldeck()')
|
699
|
|
- else:
|
700
|
|
- own['throw_deck'] = False
|
701
|
|
- deckact.visibility = True
|
702
|
|
- trucksact.visibility = True
|
703
|
|
- wheel1act.visibility = True
|
704
|
|
- wheel2act.visibility = True
|
705
|
|
- wheel3act.visibility = True
|
706
|
|
- wheel4act.visibility = True
|
707
|
|
- throw_deck_empty['kill_deck'] = 1
|
708
|
|
- cont.activate(deck.actuators['Visibility'])
|
709
|
|
- cont.activate(trucks.actuators['Visibility'])
|
710
|
|
- cont.activate(wheel1.actuators['Visibility'])
|
711
|
|
- cont.activate(wheel2.actuators['Visibility'])
|
712
|
|
- cont.activate(wheel3.actuators['Visibility'])
|
713
|
|
- cont.activate(wheel4.actuators['Visibility'])
|
|
668
|
+ # if udPad == 1:
|
|
669
|
+ # own['spawn_pos'] = [own.worldPosition[0], own.worldPosition[1], own.worldPosition[2]]
|
|
670
|
+ # own['spawn_rot'] = [[own.worldOrientation[0][0],own.worldOrientation[0][1],own.worldOrientation[0][2]], [own.worldOrientation[1][0],own.worldOrientation[1][1],own.worldOrientation[1][2]], own.worldOrientation[2][2]]
|
|
671
|
+ # own['spawn_cam_pos'] = [cam.worldPosition[0], cam.worldPosition[1], cam.worldPosition[2]]
|
|
672
|
+ # own['spawn_cam_rot'] = [[cam.worldOrientation[0][0],cam.worldOrientation[0][1],cam.worldOrientation[0][2]], [cam.worldOrientation[1][0],cam.worldOrientation[1][1],cam.worldOrientation[1][2]], cam.worldOrientation[2][2]]
|
|
673
|
+ # stance = own["stance"]
|
|
674
|
+ # own["spawn_stance"] = stance
|
|
675
|
+ # def falldeck():
|
|
676
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
677
|
+ # throw_deck_empty.worldPosition.y += .5
|
|
678
|
+ # throw_deck_empty.worldPosition.x += .5
|
|
679
|
+ # deckact = deck.actuators["Visibility"]
|
|
680
|
+ # trucksact = trucks.actuators["Visibility"]
|
|
681
|
+ # wheel1act = wheel1.actuators["Visibility"]
|
|
682
|
+ # wheel2act = wheel2.actuators["Visibility"]
|
|
683
|
+ # wheel3act = wheel3.actuators["Visibility"]
|
|
684
|
+ # wheel4act = wheel4.actuators["Visibility"]
|
|
685
|
+ # print('doing falldeck')
|
|
686
|
+ # if own['throw_deck'] == False:
|
|
687
|
+ # own['throw_deck'] = True
|
|
688
|
+ # deckact.visibility = False
|
|
689
|
+ # trucksact.visibility = False
|
|
690
|
+ # wheel1act.visibility = False
|
|
691
|
+ # wheel2act.visibility = False
|
|
692
|
+ # wheel3act.visibility = False
|
|
693
|
+ # wheel4act.visibility = False
|
|
694
|
+ # act = throw_deck_empty.actuators['throw_dec_act']
|
|
695
|
+ # if STANCE == True:
|
|
696
|
+ # act.linearVelocity = [0.0, 1.0, 1.0]
|
|
697
|
+ # if STANCE == False:
|
|
698
|
+ # act.linearVelocity = [0.0, 1.0, -1.0]
|
|
699
|
+ # cont.activate(act)
|
|
700
|
+ # print('running falldeck()')
|
|
701
|
+ # else:
|
|
702
|
+ # own['throw_deck'] = False
|
|
703
|
+ # deckact.visibility = True
|
|
704
|
+ # trucksact.visibility = True
|
|
705
|
+ # wheel1act.visibility = True
|
|
706
|
+ # wheel2act.visibility = True
|
|
707
|
+ # wheel3act.visibility = True
|
|
708
|
+ # wheel4act.visibility = True
|
|
709
|
+ # throw_deck_empty['kill_deck'] = 1
|
|
710
|
+ # cont.activate(deck.actuators['Visibility'])
|
|
711
|
+ # cont.activate(trucks.actuators['Visibility'])
|
|
712
|
+ # cont.activate(wheel1.actuators['Visibility'])
|
|
713
|
+ # cont.activate(wheel2.actuators['Visibility'])
|
|
714
|
+ # cont.activate(wheel3.actuators['Visibility'])
|
|
715
|
+ # cont.activate(wheel4.actuators['Visibility'])
|
714
|
716
|
|
715
|
|
- def throwdeck(strength, ud):
|
716
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
717
|
|
- deckact = deck.actuators["Visibility"]
|
718
|
|
- trucksact = trucks.actuators["Visibility"]
|
719
|
|
- wheel1act = wheel1.actuators["Visibility"]
|
720
|
|
- wheel2act = wheel2.actuators["Visibility"]
|
721
|
|
- wheel3act = wheel3.actuators["Visibility"]
|
722
|
|
- wheel4act = wheel4.actuators["Visibility"]
|
|
717
|
+ # def throwdeck(strength, ud):
|
|
718
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
719
|
+ # deckact = deck.actuators["Visibility"]
|
|
720
|
+ # trucksact = trucks.actuators["Visibility"]
|
|
721
|
+ # wheel1act = wheel1.actuators["Visibility"]
|
|
722
|
+ # wheel2act = wheel2.actuators["Visibility"]
|
|
723
|
+ # wheel3act = wheel3.actuators["Visibility"]
|
|
724
|
+ # wheel4act = wheel4.actuators["Visibility"]
|
723
|
725
|
|
724
|
|
- if own['throw_deck'] == False:
|
725
|
|
- own['throw_deck'] = True
|
726
|
|
- deckact.visibility = False
|
727
|
|
- trucksact.visibility = False
|
728
|
|
- wheel1act.visibility = False
|
729
|
|
- wheel2act.visibility = False
|
730
|
|
- wheel3act.visibility = False
|
731
|
|
- wheel4act.visibility = False
|
732
|
|
- act = throw_deck_empty.actuators['throw_dec_act']
|
733
|
|
- hard = strength * .08
|
734
|
|
- if hard > 9:
|
735
|
|
- hard = 9
|
736
|
|
- if hard < 1:
|
737
|
|
- hard = 1
|
738
|
|
- ud = ud * 4
|
739
|
|
- own['bbut_timer'] = 0
|
740
|
|
- if STANCE == True:
|
741
|
|
- own['requestAction'] = 'fak_throw'
|
742
|
|
- act.linearVelocity = [0.0, ud, hard]
|
743
|
|
- if STANCE == False:
|
744
|
|
- own['requestAction'] = 'fak_throw'
|
745
|
|
- act.linearVelocity = [0.0, ud, -hard]
|
746
|
|
- cont.activate(act)
|
747
|
|
- else:
|
748
|
|
- own['throw_deck'] = False
|
749
|
|
- deckact.visibility = True
|
750
|
|
- trucksact.visibility = True
|
751
|
|
- wheel1act.visibility = True
|
752
|
|
- wheel2act.visibility = True
|
753
|
|
- wheel3act.visibility = True
|
754
|
|
- wheel4act.visibility = True
|
755
|
|
- throw_deck_empty['kill_deck'] = 1
|
756
|
|
- cont.activate(deck.actuators['Visibility'])
|
757
|
|
- cont.activate(trucks.actuators['Visibility'])
|
758
|
|
- cont.activate(wheel1.actuators['Visibility'])
|
759
|
|
- cont.activate(wheel2.actuators['Visibility'])
|
760
|
|
- cont.activate(wheel3.actuators['Visibility'])
|
761
|
|
- cont.activate(wheel4.actuators['Visibility'])
|
762
|
|
- def throwdeck_trigger():
|
763
|
|
- lastb = own['lastb']
|
764
|
|
- throw_deck_empty = scene.objects["throw_deck_empty"]
|
765
|
|
- if bBut == True:
|
766
|
|
- own['bbut_timer'] += 1
|
767
|
|
- ud = (rUD * 10) +1
|
768
|
|
- if bBut == False:
|
769
|
|
- throw_deck_empty['kill_deck'] = 0
|
770
|
|
- if bBut == False and own['lastb'] == True:
|
771
|
|
- strength = own['bbut_timer']
|
772
|
|
- ud = (rUD * 10) +1
|
773
|
|
- throwdeck(strength, ud)
|
|
726
|
+ # if own['throw_deck'] == False:
|
|
727
|
+ # own['throw_deck'] = True
|
|
728
|
+ # deckact.visibility = False
|
|
729
|
+ # trucksact.visibility = False
|
|
730
|
+ # wheel1act.visibility = False
|
|
731
|
+ # wheel2act.visibility = False
|
|
732
|
+ # wheel3act.visibility = False
|
|
733
|
+ # wheel4act.visibility = False
|
|
734
|
+ # act = throw_deck_empty.actuators['throw_dec_act']
|
|
735
|
+ # hard = strength * .08
|
|
736
|
+ # if hard > 9:
|
|
737
|
+ # hard = 9
|
|
738
|
+ # if hard < 1:
|
|
739
|
+ # hard = 1
|
|
740
|
+ # ud = ud * 4
|
|
741
|
+ # own['bbut_timer'] = 0
|
|
742
|
+ # if STANCE == True:
|
|
743
|
+ # own['requestAction'] = 'fak_throw'
|
|
744
|
+ # act.linearVelocity = [0.0, ud, hard]
|
|
745
|
+ # if STANCE == False:
|
|
746
|
+ # own['requestAction'] = 'fak_throw'
|
|
747
|
+ # act.linearVelocity = [0.0, ud, -hard]
|
|
748
|
+ # cont.activate(act)
|
|
749
|
+ # else:
|
|
750
|
+ # own['throw_deck'] = False
|
|
751
|
+ # deckact.visibility = True
|
|
752
|
+ # trucksact.visibility = True
|
|
753
|
+ # wheel1act.visibility = True
|
|
754
|
+ # wheel2act.visibility = True
|
|
755
|
+ # wheel3act.visibility = True
|
|
756
|
+ # wheel4act.visibility = True
|
|
757
|
+ # throw_deck_empty['kill_deck'] = 1
|
|
758
|
+ # cont.activate(deck.actuators['Visibility'])
|
|
759
|
+ # cont.activate(trucks.actuators['Visibility'])
|
|
760
|
+ # cont.activate(wheel1.actuators['Visibility'])
|
|
761
|
+ # cont.activate(wheel2.actuators['Visibility'])
|
|
762
|
+ # cont.activate(wheel3.actuators['Visibility'])
|
|
763
|
+ # cont.activate(wheel4.actuators['Visibility'])
|
|
764
|
+ # def throwdeck_trigger():
|
|
765
|
+ # lastb = own['lastb']
|
|
766
|
+ # throw_deck_empty = scene.objects["throw_deck_empty"]
|
|
767
|
+ # if bBut == True:
|
|
768
|
+ # own['bbut_timer'] += 1
|
|
769
|
+ # ud = (rUD * 10) +1
|
|
770
|
+ # if bBut == False:
|
|
771
|
+ # throw_deck_empty['kill_deck'] = 0
|
|
772
|
+ # if bBut == False and own['lastb'] == True:
|
|
773
|
+ # strength = own['bbut_timer']
|
|
774
|
+ # ud = (rUD * 10) +1
|
|
775
|
+ # throwdeck(strength, ud)
|
774
|
776
|
|
775
|
|
- def focus_deck():
|
776
|
|
- since_air = own['framenum'] - own['lF_air_frame']
|
777
|
|
- if cb_td.positive and since_air < 10:
|
778
|
|
- object = 'focus_deckA'
|
779
|
|
- object2 = 'focus_deckB'
|
780
|
|
- other = throw_deck_empty
|
781
|
|
- throw_deck = scene.objects["throw_deck"]
|
782
|
|
- throw_deck.endObject()
|
783
|
|
- scene.addObject(object, other, 0)
|
784
|
|
- scene.addObject(object2, other, 0)
|
|
777
|
+ # def focus_deck():
|
|
778
|
+ # since_air = own['framenum'] - own['lF_air_frame']
|
|
779
|
+ # if cb_td.positive and since_air < 10:
|
|
780
|
+ # object = 'focus_deckA'
|
|
781
|
+ # object2 = 'focus_deckB'
|
|
782
|
+ # other = throw_deck_empty
|
|
783
|
+ # throw_deck = scene.objects["throw_deck"]
|
|
784
|
+ # throw_deck.endObject()
|
|
785
|
+ # scene.addObject(object, other, 0)
|
|
786
|
+ # scene.addObject(object2, other, 0)
|
785
|
787
|
|
786
|
|
- if own['throw_deck'] == True:
|
787
|
|
- if dict['ldPad'] == False and dict['last_ldPad'] == True:
|
788
|
|
- object = 'focus_deckA'
|
789
|
|
- object2 = 'focus_deckB'
|
790
|
|
- other = throw_deck_empty
|
791
|
|
- scene.addObject(object, other, 0)
|
792
|
|
- scene.addObject(object2, other, 0)
|
|
788
|
+ # if own['throw_deck'] == True:
|
|
789
|
+ # if dict['ldPad'] == False and dict['last_ldPad'] == True:
|
|
790
|
+ # object = 'focus_deckA'
|
|
791
|
+ # object2 = 'focus_deckB'
|
|
792
|
+ # other = throw_deck_empty
|
|
793
|
+ # scene.addObject(object, other, 0)
|
|
794
|
+ # scene.addObject(object2, other, 0)
|
793
|
795
|
|
794
|
|
- def fall():
|
795
|
|
- if own['fall'] == True:
|
796
|
|
- falldeck()
|
797
|
|
- if STANCE == 1:
|
798
|
|
- own['requestAction'] = 'fak_air-walk_air'
|
799
|
|
- #own.setLinearVelocity([3,2,0], True)
|
800
|
|
- else:
|
801
|
|
- own['requestAction'] = 'reg_air-walk_air'
|
802
|
|
- #own.setLinearVelocity([-3,-2,0], True)
|
803
|
|
- own['fall'] = False
|
804
|
|
- own.worldPosition.z += .3
|
805
|
|
- print('falling from walk.py')
|
|
796
|
+ # def fall():
|
|
797
|
+ # if own['fall'] == True:
|
|
798
|
+ # falldeck()
|
|
799
|
+ # if STANCE == 1:
|
|
800
|
+ # own['requestAction'] = 'fak_air-walk_air'
|
|
801
|
+ # #own.setLinearVelocity([3,2,0], True)
|
|
802
|
+ # else:
|
|
803
|
+ # own['requestAction'] = 'reg_air-walk_air'
|
|
804
|
+ # #own.setLinearVelocity([-3,-2,0], True)
|
|
805
|
+ # own['fall'] = False
|
|
806
|
+ # own.worldPosition.z += .3
|
|
807
|
+ # print('falling from walk.py')
|
806
|
808
|
|
807
|
|
- def sit():
|
808
|
|
- #turn off sit
|
809
|
|
- if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
|
810
|
|
- if own['sit'] == 1:
|
811
|
|
- killact(300)
|
812
|
|
- killact(299)
|
813
|
|
- own['sit'] = 0
|
|
809
|
+ # def sit():
|
|
810
|
+ # #turn off sit
|
|
811
|
+ # if lup == 1 or ldown == 1 or lUD > sens or lUD < -sens:
|
|
812
|
+ # if own['sit'] == 1:
|
|
813
|
+ # killact(300)
|
|
814
|
+ # killact(299)
|
|
815
|
+ # own['sit'] = 0
|
814
|
816
|
|
815
|
|
- if aBut == True and lasta == False:
|
816
|
|
- try:
|
817
|
|
- if 'sit' in r_ground.hitObject:
|
818
|
|
- #print("sit")
|
819
|
|
- own['sit'] = 1
|
820
|
|
- killact(3)
|
821
|
|
- if STANCE == 0:
|
822
|
|
- own['requestAction'] = 'reg_sit'
|
823
|
|
- elif STANCE == 1:
|
824
|
|
- own['requestAction'] = 'fak_sit'
|
825
|
|
- except:
|
826
|
|
- pass
|
827
|
|
- if own['sit'] == 1:
|
828
|
|
- try:
|
829
|
|
- killact(3)
|
830
|
|
- sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
|
831
|
|
- if STANCE == 0:
|
832
|
|
- own.alignAxisToVect(-sit_vect, 0, .2)
|
833
|
|
- own['requestAction'] = 'reg_sit'
|
|
817
|
+ # if aBut == True and lasta == False:
|
|
818
|
+ # try:
|
|
819
|
+ # if 'sit' in r_ground.hitObject:
|
|
820
|
+ # #print("sit")
|
|
821
|
+ # own['sit'] = 1
|
|
822
|
+ # killact(3)
|
|
823
|
+ # if STANCE == 0:
|
|
824
|
+ # own['requestAction'] = 'reg_sit'
|
|
825
|
+ # elif STANCE == 1:
|
|
826
|
+ # own['requestAction'] = 'fak_sit'
|
|
827
|
+ # except:
|
|
828
|
+ # pass
|
|
829
|
+ # if own['sit'] == 1:
|
|
830
|
+ # try:
|
|
831
|
+ # killact(3)
|
|
832
|
+ # sit_vect = r_ground.hitObject.getAxisVect( [0, 1, 0])
|
|
833
|
+ # if STANCE == 0:
|
|
834
|
+ # own.alignAxisToVect(-sit_vect, 0, .2)
|
|
835
|
+ # own['requestAction'] = 'reg_sit'
|
834
|
836
|
|
835
|
|
- elif STANCE == 1:
|
836
|
|
- own['requestAction'] = 'fak_sit'
|
837
|
|
- own.alignAxisToVect(sit_vect, 0, .2)
|
838
|
|
- except:
|
839
|
|
- pass
|
|
837
|
+ # elif STANCE == 1:
|
|
838
|
+ # own['requestAction'] = 'fak_sit'
|
|
839
|
+ # own.alignAxisToVect(sit_vect, 0, .2)
|
|
840
|
+ # except:
|
|
841
|
+ # pass
|
840
|
842
|
|
841
|
843
|
|
842
|
|
- if r_ground.triggered == False:
|
843
|
|
- cont.deactivate(own.actuators["walk_align"])
|
844
|
|
- else:
|
845
|
|
- cont.activate(own.actuators["walk_align"])
|
|
844
|
+ # if r_ground.triggered == False:
|
|
845
|
+ # cont.deactivate(own.actuators["walk_align"])
|
|
846
|
+ # else:
|
|
847
|
+ # cont.activate(own.actuators["walk_align"])
|
846
|
848
|
|
847
|
|
- #walking on stairs
|
848
|
|
- if r_ground.triggered:
|
849
|
|
- try:
|
850
|
|
- if 'stair' in r_ground.hitObject:
|
851
|
|
- own['stair_counter'] = 20
|
|
849
|
+ # #walking on stairs
|
|
850
|
+ # if r_ground.triggered:
|
|
851
|
+ # try:
|
|
852
|
+ # if 'stair' in r_ground.hitObject:
|
|
853
|
+ # own['stair_counter'] = 20
|
852
|
854
|
|
853
|
|
- except:
|
854
|
|
- pass
|
855
|
|
- if own['stair_counter'] > 0:
|
856
|
|
- own.linearVelocity.z += .1
|
857
|
|
- own['stair_counter'] -= 1
|
|
855
|
+ # except:
|
|
856
|
+ # pass
|
|
857
|
+ # if own['stair_counter'] > 0:
|
|
858
|
+ # own.linearVelocity.z += .1
|
|
859
|
+ # own['stair_counter'] -= 1
|
858
|
860
|
|
859
|
|
- if yBut == True:
|
860
|
|
- own['walk_idling'] = 0
|
861
|
|
- own["walk_idle_frame"] = 0
|
|
861
|
+ # if yBut == True:
|
|
862
|
+ # own['walk_idling'] = 0
|
|
863
|
+ # own["walk_idle_frame"] = 0
|
862
|
864
|
|
863
|
865
|
|
864
|
866
|
|
865
|
|
- if own['stair_counter'] > 5 and r_ground.triggered == False:
|
866
|
|
- own.applyForce([0,0,-200], True)
|
|
867
|
+ # if own['stair_counter'] > 5 and r_ground.triggered == False:
|
|
868
|
+ # own.applyForce([0,0,-200], True)
|
867
|
869
|
|
868
|
|
- if deck.visible:
|
869
|
|
- own['deckvis'] = 1
|
870
|
|
- else:
|
871
|
|
- own['deckvis'] = 0
|
|
870
|
+ # if deck.visible:
|
|
871
|
+ # own['deckvis'] = 1
|
|
872
|
+ # else:
|
|
873
|
+ # own['deckvis'] = 0
|
872
|
874
|
|
873
|
|
- if own['requestAction'] == 'empty' or own['requestAction'] == None:
|
874
|
|
- if STANCE == 0:
|
875
|
|
- own['requestAction'] = 'reg_idle1'
|
876
|
|
- if STANCE == 1:
|
877
|
|
- own['requestAction'] = 'fak_idle1'
|
|
875
|
+ # if own['requestAction'] == 'empty' or own['requestAction'] == None:
|
|
876
|
+ # if STANCE == 0:
|
|
877
|
+ # own['requestAction'] = 'reg_idle1'
|
|
878
|
+ # if STANCE == 1:
|
|
879
|
+ # own['requestAction'] = 'fak_idle1'
|
878
|
880
|
|
879
|
|
- def onground():
|
880
|
|
- if r_ground.positive:
|
881
|
|
- own['lF_ground_frame'] = own['framenum']
|
882
|
|
- if 'grind' in r_ground.hitObject:
|
883
|
|
- if own['framenum'] - own['last_fall_frame'] < 90:
|
884
|
|
- #own.applyForce([0,100,0], True)
|
885
|
|
- pass
|
886
|
|
- #print('moving away from rail')
|
|
881
|
+ # def onground():
|
|
882
|
+ # if r_ground.positive:
|
|
883
|
+ # own['lF_ground_frame'] = own['framenum']
|
|
884
|
+ # if 'grind' in r_ground.hitObject:
|
|
885
|
+ # if own['framenum'] - own['last_fall_frame'] < 90:
|
|
886
|
+ # #own.applyForce([0,100,0], True)
|
|
887
|
+ # pass
|
|
888
|
+ # #print('moving away from rail')
|
887
|
889
|
|
888
|
|
- yvel = own.linearVelocity.y
|
889
|
|
- yvel = yvel *.1
|
890
|
|
- if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01 and own['stair_counter'] == 0:
|
891
|
|
- if STANCE == 0:
|
892
|
|
- own.applyRotation([0,0,-yvel], True)
|
893
|
|
- else:
|
894
|
|
- own.applyRotation([0,0,yvel], True)
|
895
|
|
- else:
|
896
|
|
- own.linearVelocity.y = 0
|
|
890
|
+ # yvel = own.linearVelocity.y
|
|
891
|
+ # yvel = yvel *.1
|
|
892
|
+ # if own.linearVelocity.y > .01 or own.linearVelocity.y < -.01 and own['stair_counter'] == 0:
|
|
893
|
+ # if STANCE == 0:
|
|
894
|
+ # own.applyRotation([0,0,-yvel], True)
|
|
895
|
+ # else:
|
|
896
|
+ # own.applyRotation([0,0,yvel], True)
|
|
897
|
+ # else:
|
|
898
|
+ # own.linearVelocity.y = 0
|
897
|
899
|
|
898
|
|
- else:
|
899
|
|
- #print('in air')
|
900
|
|
- if own['framenum'] - own['lF_ground_frame'] > 10:
|
901
|
|
- if STANCE == 0:
|
902
|
|
- own['requestAction'] = 'reg_walk_air'
|
903
|
|
- else:
|
904
|
|
- own['requestAction'] = 'fak_walk_air'
|
905
|
|
- #if control bottom is touching ground object, turn ground on
|
906
|
|
- if cb.positive:
|
907
|
|
- if own['framenum'] - own['last_fall_frame'] < 90:
|
908
|
|
- own['lF_ground_frame'] = own['framenum']
|
|
900
|
+ # else:
|
|
901
|
+ # #print('in air')
|
|
902
|
+ # if own['framenum'] - own['lF_ground_frame'] > 10:
|
|
903
|
+ # if STANCE == 0:
|
|
904
|
+ # own['requestAction'] = 'reg_walk_air'
|
|
905
|
+ # else:
|
|
906
|
+ # own['requestAction'] = 'fak_walk_air'
|
|
907
|
+ # #if control bottom is touching ground object, turn ground on
|
|
908
|
+ # if cb.positive:
|
|
909
|
+ # if own['framenum'] - own['last_fall_frame'] < 90:
|
|
910
|
+ # own['lF_ground_frame'] = own['framenum']
|
909
|
911
|
|
910
|
912
|
|
911
|
913
|
|
912
|
|
- def get_in_car():
|
913
|
|
- vehicleNear = cont.sensors["vehicleNear"]
|
914
|
|
- #print('vh', vehicleNear.positive)
|
915
|
|
- scene = bge.logic.getCurrentScene()
|
916
|
|
- cam = scene.active_camera
|
917
|
|
- #dict = bge.logic.globalDict
|
918
|
|
- if vehicleNear.positive and 'car' in vehicleNear.hitObject:
|
919
|
|
- obj = vehicleNear.hitObject
|
920
|
|
- if yBut == True:
|
921
|
|
- obj['driving'] = True
|
922
|
|
- own['driving'] = True
|
923
|
|
- cube.suspendDynamics(True)
|
924
|
|
- cube.worldPosition = obj.worldPosition
|
925
|
|
- cube.worldOrientation = obj.worldOrientation
|
926
|
|
- rot = [ 0.0, 0.0, 1.570796327]
|
927
|
|
- cube.applyRotation(rot,False)
|
928
|
|
- compound = False
|
|
914
|
+ # def get_in_car():
|
|
915
|
+ # vehicleNear = cont.sensors["vehicleNear"]
|
|
916
|
+ # #print('vh', vehicleNear.positive)
|
|
917
|
+ # scene = bge.logic.getCurrentScene()
|
|
918
|
+ # cam = scene.active_camera
|
|
919
|
+ # #dict = bge.logic.globalDict
|
|
920
|
+ # if vehicleNear.positive and 'car' in vehicleNear.hitObject:
|
|
921
|
+ # obj = vehicleNear.hitObject
|
|
922
|
+ # if yBut == True:
|
|
923
|
+ # obj['driving'] = True
|
|
924
|
+ # own['driving'] = True
|
|
925
|
+ # cube.suspendDynamics(True)
|
|
926
|
+ # cube.worldPosition = obj.worldPosition
|
|
927
|
+ # cube.worldOrientation = obj.worldOrientation
|
|
928
|
+ # rot = [ 0.0, 0.0, 1.570796327]
|
|
929
|
+ # cube.applyRotation(rot,False)
|
|
930
|
+ # compound = False
|
929
|
931
|
|
930
|
|
- # child is solid
|
931
|
|
- ghost = True
|
|
932
|
+ # # child is solid
|
|
933
|
+ # ghost = True
|
932
|
934
|