shuvit 3 years ago
parent
commit
e79c4c7f2f
4 changed files with 33 additions and 11 deletions
  1. 3
    0
      scripts/StatesGame.py
  2. 1
    1
      scripts/player.py
  3. 7
    3
      scripts/puck.py
  4. 22
    7
      scripts/sound_man.py

+ 3
- 0
scripts/StatesGame.py View File

@@ -302,6 +302,9 @@ class TeamsOffIce(State):
302 302
         self.FSM.stateLife += 1
303 303
         o = self.FSM.owner
304 304
         bps = o.a_team_bench + o.b_team_bench
305
+
306
+
307
+        
305 308
         if self.FSM.stateLife == 280:
306 309
             for o in bps:
307 310
                 pass

+ 1
- 1
scripts/player.py View File

@@ -352,7 +352,7 @@ class game:
352 352
         #self.a_team.user_input = joystick_input(2, 0)
353 353
         #self.b_team.user_input = joystick_input(3, 1)
354 354
         self.b_team.user_input = cpu_input(0)
355
-        self.period_length = 7 * 60#2 * 60 * 60
355
+        self.period_length = 60 * 60#2 * 60 * 60
356 356
         self.period = 1
357 357
 
358 358
         self.a_team.own_net = self.goal_b_e

+ 7
- 3
scripts/puck.py View File

@@ -34,9 +34,13 @@ def puck(cont):
34 34
             
35 35
         if cont.sensors['puck-player'].hitObject is not None:
36 36
             ho = cont.sensors['puck-player'].hitObject
37
-            if 'post' in ho or 'goal' in ho:
37
+            
38
+            if 'post' in ho or 'net' in ho:
38 39
                 print('POST!!!!')
39
-                g.sound_man.queue_sound(['post', g.puck, g.camera]) 
40
+                if g.frame - g.sound_man.post_played > 60:
41
+                    g.sound_man.queue_sound(['post', g.puck, g.camera]) 
42
+                    g.sound_man.post_played = g.frame 
43
+
40 44
             elif 'board' in ho:
41 45
                 print('BOARD!!!!')
42 46
                 if g.frame - g.sound_man.board_played > 30:
@@ -56,7 +60,7 @@ def puck(cont):
56 60
                 o = cont.sensors['puck-player'].hitObject
57 61
                 if 'goal' in o:
58 62
 
59
-                    print('GOOOAAAALLL!!', o['team'])
63
+                    #print('GOOOAAAALLL!!', o['team'])
60 64
                     if o['team'] == 'a':
61 65
                         g.score[0] += 1
62 66
                         g.a_team.scored = True

+ 22
- 7
scripts/sound_man.py View File

@@ -16,6 +16,7 @@ def init_sounds(self):
16 16
 	self.puck_drop = sounds('puck_drop')
17 17
 	self.board = sounds('board')		
18 18
 	self.board_played = 0
19
+	self.post_played = 0
19 20
 
20 21
 
21 22
 class sound_manager:
@@ -33,11 +34,25 @@ class sound_manager:
33 34
 		self.queue.remove(sound)
34 35
 
35 36
 	def play_queue(self):
36
-		if self.queue is not []:
37
+		#if self.queue is not []:
38
+		if self.queue:	
39
+			#print(self.queue)
40
+			
37 41
 			self.h_queue = self.queue.copy()
42
+			print('something3')
38 43
 			for ev in self.queue:
39 44
 				#get function from string at position 0 of event
40 45
 				result = getattr(self, ev[0])
46
+				print(result.handle_buffered)
47
+				print('something2')
48
+				
49
+				# if result.handle_buffered:
50
+				# 	print('something')
51
+				# 	print(result.handle_buffered.status, 'buffer status')
52
+				# 	if result.handle_buffered.status:
53
+				# 		print('stopping dupes')
54
+				# 		return
55
+
41 56
 				if result.loop:
42 57
 					result.loop_play(ev[1], ev[2], ev[3], ev[4])
43 58
 				else:
@@ -109,12 +124,12 @@ class sounds(sound_manager):
109 124
 		self.device.listener_velocity = obj.getLinearVelocity()
110 125
 		self.device.volume = self.volume
111 126
 
112
-		handle_buffered = self.device.play(self.factory_buffered)
113
-		handle_buffered.relative = False
114
-		handle_buffered.location = listener.worldPosition
115
-		handle_buffered.velocity = listener.getLinearVelocity()
116
-		handle_buffered.distance_maximum = 25
117
-		handle_buffered.distance_reference = 1
127
+		self.handle_buffered = self.device.play(self.factory_buffered)
128
+		self.handle_buffered.relative = False
129
+		self.handle_buffered.location = listener.worldPosition
130
+		self.handle_buffered.velocity = listener.getLinearVelocity()
131
+		self.handle_buffered.distance_maximum = 25
132
+		self.handle_buffered.distance_reference = 1
118 133
 
119 134
         
120 135
 	def loop_play(self, obj, listener, v, p):

Loading…
Cancel
Save