import pygame import random # --- Rusztowanie --- pygame.init() WIDTH, HEIGHT = 800, 400 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Pygame") clock = pygame.time.Clock() font = pygame.font.SysFont("Arial", 30) # def update_player(player, current_gravity): # Tu zaczynamy return player def update_obstacles(walls, coins, current_speed, obstacle_count): pass def draw_game(player, walls, coins, score, is_active): pass def main(): player = pygame.Rect(100, 200, 30, 30) walls = [] coins = [] gravity = 7 speed = 6 score = 0 obstacle_count = 1 game_active = True while True: for event in pygame.event.get(): if event.type == pygame.QUIT: exit() if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE: if game_active: gravity = gravity * -1 else: player.y = 200 walls.clear() coins.clear() score = 0 game_active = True if game_active: player = update_player(player, gravity) walls, coins, obstacle_count = update_obstacles(walls, coins, speed, obstacle_count) if player.collidelist(walls) != -1: game_active = False hit_index = player.collidelist(coins) if hit_index != -1: coins.pop(hit_index) score += 5 speed += 0.5 draw_game(player, walls, coins, score, game_active) clock.tick(60) main()