@wertlim

Не работает код ошибка в описание использовал только библиотеку pygame поможите?

import pygame

pygame.init()
win = pygame.display.set_mode((1000, 700))

pygame.display.set_caption("GAME")


x = 500
y = 620
width = 50
height = 65
speed = 10

isJump = False
jumpCount = 10


run = True
while run:
	pygame.time.delay(50)

	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			run = False

	keys = pygame.key.get_pressed()
	if keys[pygame.K_LEFT] and x > 5:
		x -= speed
	if keys[pygame.K_RIGHT] and x < 1000 - width - 5:
		x += speed
	if not(isJump):
		if keys[pygame.K_SPACE]:
			isJump = True
	else:
		if jumpCount >= -10:
			if jumpCount < 0:
				y += (jumpCount ** 2) / 2
			else:
				y -= (jumpCount ** 2) / 2
			jumpCount -= 1
		else:
			isJump = False
			JumpCount = 10
	win.fill((0,0,0))	
	pygame.draw.rect(win, (128, 0, 128), (x, y, width, height))
	pygame.display.update()

pygame.quit()


Ошибка:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
game.py:61: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
pygame.draw.rect(win, (128, 0, 128), (x, y, width, height))
  • Вопрос задан
  • 106 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы