47
47
player1_pos = [50 , HEIGHT // 2 - player_height // 2 ]
48
48
player2_pos = [WIDTH - 50 - player_width , HEIGHT // 2 - player_height // 2 ]
49
49
50
+ # Font settings
51
+ font_size = 50
52
+ font = pygame .font .Font (None , font_size )
53
+ title_text = "Force Ball Game"
54
+
55
+ title_surface = font .render (title_text , True , WHITE )
56
+ title_rect = title_surface .get_rect (center = (800 // 2 , font_size )) # Center at the top middle
57
+
50
58
clock = pygame .time .Clock ()
51
59
52
60
eeg_queue = queue .Queue () # Initialize EEG queue
@@ -85,6 +93,7 @@ def eeg_data_thread(eeg_queue):
85
93
return
86
94
87
95
inlet = StreamInlet (streams [0 ])
96
+ channel_assignments = {0 :'Player A' , 1 :'Player B' }
88
97
sampling_frequency = 500
89
98
bands = {'Alpha' : [8 , 13 ],'Beta' : [13 , 30 ]}
90
99
buffer_length = sampling_frequency * 1
@@ -188,8 +197,8 @@ def update_ball_position(force_player1, force_player2, threshold=0.7):
188
197
print (f"Force Player 1: { average_force1 :.2f} , Force Player 2: { average_force2 :.2f} , Net Force: { net_force :.2f} " )
189
198
190
199
def draw_buttons (paused , first_attempt ): # Button dimensions and positions
191
- button_width = 120
192
- button_height = 40
200
+ button_width = 140
201
+ button_height = 50
193
202
button_radius = 15 # Radius for rounded corners
194
203
195
204
# Button positions (y-position is moved up slightly for a better fit)
@@ -249,6 +258,7 @@ def main():
249
258
250
259
while True :
251
260
screen .fill (BLACK )
261
+ screen .blit (title_surface , title_rect ) # For Title of the game
252
262
253
263
pygame .draw .circle (screen , ball_color , (int (ball_pos [0 ]), int (ball_pos [1 ])), ball_radius ) # Draw the ball
254
264
@@ -313,4 +323,6 @@ def main():
313
323
314
324
# Threshold = 0.7
315
325
# Moving Average of last 10 values of powerData.
316
- # Ball Speed = 30
326
+ # Ball Speed = 30
327
+ # Adding the font title "Force Ball Game"
328
+ # Sleep of 1 sec so that game reset properly
0 commit comments