MCPcopy Index your code
hub / github.com/geekcomputers/Python / main_menu

Function main_menu

Street_Fighter/src/main.py:171–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169
170
171def main_menu():
172 animation_start_time = pygame.time.get_ticks()
173
174 while True:
175 draw_bg(bg_image, is_game_started=False)
176
177 elapsed_time = (pygame.time.get_ticks() - animation_start_time) / 1000
178 scale_factor = 1 + 0.05 * math.sin(elapsed_time * 2 * math.pi) # Slight scaling
179 scaled_font = pygame.font.Font(
180 "assets/fonts/turok.ttf", int(100 * scale_factor)
181 )
182
183 title_text = "STREET FIGHTER"
184 colors = [BLUE, GREEN, YELLOW]
185 shadow_color = BLACK
186 title_x = SCREEN_WIDTH // 2 - scaled_font.size(title_text)[0] // 2
187 title_y = SCREEN_HEIGHT // 6
188
189 shadow_offset = 5
190 draw_text(
191 title_text,
192 scaled_font,
193 shadow_color,
194 title_x + shadow_offset,
195 title_y + shadow_offset,
196 )
197 draw_gradient_text(title_text, scaled_font, title_x, title_y, colors)
198
199 button_width = 280
200 button_height = 60
201 button_spacing = 30
202
203 start_button_y = (
204 SCREEN_HEIGHT // 2 - (button_height + button_spacing) * 1.5 + 50
205 )
206 scores_button_y = (
207 SCREEN_HEIGHT // 2 - (button_height + button_spacing) * 0.5 + 50
208 )
209 exit_button_y = SCREEN_HEIGHT // 2 + (button_height + button_spacing) * 0.5 + 50
210
211 start_button = draw_button(
212 "START GAME",
213 menu_font,
214 BLACK,
215 GREEN,
216 SCREEN_WIDTH // 2 - button_width // 2,
217 start_button_y,
218 button_width,
219 button_height,
220 )
221 scores_button = draw_button(
222 "SCORES",
223 menu_font,
224 BLACK,
225 GREEN,
226 SCREEN_WIDTH // 2 - button_width // 2,
227 scores_button_y,
228 button_width,

Callers 1

main.pyFile · 0.85

Calls 8

draw_bgFunction · 0.85
draw_textFunction · 0.85
draw_gradient_textFunction · 0.85
draw_buttonFunction · 0.85
exitFunction · 0.85
sizeMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected