reworked the code structure for better feature implementation

This commit is contained in:
IM23a-bachmannj2
2025-01-28 18:40:20 +01:00
parent 24a1284a35
commit 9e419baedd
7 changed files with 271 additions and 203 deletions
+23
View File
@@ -0,0 +1,23 @@
import pygame
def get_fall_interval(score):
"""
Calculate the fall interval based on the current score.
"""
base_interval = 1000 # Base interval in milliseconds
decrease_per_1000_points = 50 # Decrease in ms per 1000 points
min_interval = 100 # Minimum interval in milliseconds
# Calculate the fall interval
interval = base_interval - (score // 400) * decrease_per_1000_points
# Ensure the interval doesn't go below the minimum
return max(interval, min_interval)
#game states
def draw_text(surface, text, size, x, y, color):
"""Utility function to render text onto a surface."""
font = pygame.font.Font(None, size) # Use default font
text_surface = font.render(text, True, color)
text_rect = text_surface.get_rect(center=(x, y))
surface.blit(text_surface, text_rect)