diff --git a/bla.py b/bla.py index 8ed184c..9a6344c 100644 --- a/bla.py +++ b/bla.py @@ -18,6 +18,7 @@ FIRE_DELAY = 1000 # Задержка между выстрелами в мил WHITE = (255, 255, 255) BLACK = (0, 0, 0) score = 0 + # Инициализация Pygame pygame.init() @@ -45,6 +46,10 @@ explosion_images = [pygame.image.load(f"explosion_{i}.png") for i in range(1, 48 stoneexplosion_images = [pygame.image.load(f"stoneexplosion_{i}.png") for i in range(1, 6)] menu_background = pygame.transform.scale(pygame.image.load("menu_background.jpg"), (SCREEN_WIDTH, SCREEN_HEIGHT)) +cursor = pygame.image.load("cursor.png") +pygame.mouse.set_visible(False) +cursor_offset_x = cursor.get_width() // 2 +cursor_offset_y = cursor.get_height() // 2 class Explosion(pygame.sprite.Sprite): def __init__(self, x, y): @@ -352,6 +357,9 @@ def draw_menu(): quit_rect = quit_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 + 100)) screen.blit(quit_text, quit_rect) + x, y = pygame.mouse.get_pos() + screen.blit(cursor, (x - cursor_offset_x, y - cursor_offset_y)) + pygame.display.flip() return start_rect, settings_rect, quit_rect @@ -379,12 +387,16 @@ def draw_settings_menu(): # Рисуем кнопку для управления музыкой if pygame.mixer.music.get_busy(): - music_text = font.render("Music Off", True, WHITE) - else: music_text = font.render("Music On", True, WHITE) + else: + music_text = font.render("Music Off", True, WHITE) music_rect = music_text.get_rect(center=(SCREEN_WIDTH // 2, SCREEN_HEIGHT // 2 - 100)) screen.blit(music_text, music_rect) + x, y = pygame.mouse.get_pos() + screen.blit(cursor, (x - cursor_offset_x, y - cursor_offset_y)) + + pygame.display.flip() return quit_rect, music_rect @@ -447,6 +459,9 @@ while running: if not paused: # If not paused, update game state # Update sprites + x, y = pygame.mouse.get_pos() + screen.blit(cursor, (x - cursor_offset_x, y - cursor_offset_y)) + all_sprites.update() # Проверка столкновений пуль с танками @@ -561,6 +576,10 @@ while running: pygame.draw.rect(screen, (0, 255, 0), ( score_rect.topleft, (score_rect.width, score_rect.height))) # Draw a green rectangle behind the score screen.blit(score_text, score_rect.topleft) + + x, y = pygame.mouse.get_pos() + screen.blit(cursor, (x - cursor_offset_x, y - cursor_offset_y)) + pygame.display.flip() clock.tick(FPS) diff --git a/cursor.png b/cursor.png new file mode 100644 index 0000000..0ebdfe2 Binary files /dev/null and b/cursor.png differ