Content deleted Content added
Tags: Reverted Mobile edit Mobile web edit |
|
* [[Script (styles of handwriting)]]
** [[Script typeface]], a typeface with characteristics of handwriting
* [[Script (Unicode)]], historical and modern scripts as organised in [[Unicode]] glyph encodingimport pygameencoding
import sys
# Инициализация Pygame
pygame.init()
# Константы экрана
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
TILE_SIZE = 32
# Цвета
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
# Инициализация экрана
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
pygame.display.set_caption("Пиксельная игра")
# Создание игрока
player_size = TILE_SIZE
player_x = SCREEN_WIDTH // 2
player_y = SCREEN_HEIGHT // 2
player_color = RED
player_speed = 5
# Основной цикл игры
clock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Управление игроком
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
player_x -= player_speed
if keys[pygame.K_RIGHT]:
player_x += player_speed
if keys[pygame.K_UP]:
player_y -= player_speed
if keys[pygame.K_DOWN]:
player_y += player_speed
# Очистка экрана
screen.fill(BLACK)
# Рисование игрока
pygame.draw.rect(screen, player_color, (player_x, player_y, player_size, player_size))
# Обновление экрана
pygame.display.flip()
# Ограничение FPS
clock.tick(60)
==Arts, entertainment, and media==
|