Compare commits
2 Commits
f1c254f928
...
012fb30005
Author | SHA1 | Date |
---|---|---|
|
012fb30005 | |
|
b9db4684b8 |
19
bla.py
19
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
|
||||
|
@ -385,6 +393,10 @@ def draw_settings_menu():
|
|||
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)
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
Loading…
Reference in New Issue