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