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