Python:
import pygame
pygame.init()
win = pygame.display.set_mode((500,200))
pygame.display.set_caption("игра")
x = 1
y = 1
higt = 30
tall = 30
spedd = 4
sjump = False
jump = 10
her = True
while her:
pygame.time.delay(35)
for i in pygame.event.get():
if i.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys[pygame.K_A] and x > 5:
x-=spedd
if keys[pygame.K_D] and x < 450:
x+=spedd
if not(sjump):
if keys[pygame.K_W] and y > 5:
y-=spedd
if keys[pygame.K_S] and y < 150:
y+=spedd
if keys[pygame.K_SHIFT] and y > 5 and y < 150 and x < 450 and x > 5:
spedd+= 3
win.fill((0,0,0))
pygame.draw.rect(win, (0, 0, 225), (x, y, higt, tall))
pygame.display.update()
pygame.quit()
2 python 3.8.2
3 библиотека pygame
Последнее редактирование: