else: if jumpCount >= -10 y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 Code else: if jumpCount >= -10 y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 что тут не так и почему выдает ошибку: else: ^ IndentationError: unexpected indent
после всех? The post was merged to previous Aug 20, 2019 найс уже другая ошибка keys = pygame.key.get_pressed() ^ IndentationError: unindent does not match any outer indentation level
import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: if jumpCount >= -10 y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 win.fill((0,0,0)) pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit() Code import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: if jumpCount >= -10 y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 win.fill((0,0,0)) pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit() The post was merged to previous Aug 20, 2019 сразу весь код скинул
else: isJump = False jumpCount = 10 win.fill((0,0,0)) Code else: isJump = False jumpCount = 10 win.fill((0,0,0)) win не на одном уровне, добавь пробел
import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: win.fill((0,0,0)) if jumpCount >= -10: y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit() HTML import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: win.fill((0,0,0)) if jumpCount >= -10: y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit()
сука все переписал и все равно не работает The post was merged to previous Aug 20, 2019 The post was merged to previous Aug 20, 2019 господи дай тебе здоровья твой код подошел благодарю просто от души The post was merged to previous Aug 20, 2019 блять ты мне код сломал теперь там одна функция не робит пиздос чо делать
Ошибка в отступе, сделай правильную табуляцию! The post was merged to previous Aug 25, 2019 Всё работает ! https://prnt.sc/ox9kx9 The post was merged to previous Aug 25, 2019 Вот код import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: if jumpCount >= -10: y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 win.fill((0,0,0)) pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit() Code import pygame pygame.init() win = pygame.display.set_mode((500, 500)) pygame.display.set_caption("Cubes Game") x = 50 y = 425 width = 40 height = 60 speed = 5 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 < 500 - width - 5: x += speed if not(isJump): if keys [pygame.K_UP] and y > 5: y -= speed if keys [pygame.K_DOWN] and y < 500 - height - 15: y += speed if keys [pygame.K_SPACE]: isJump = True else: if jumpCount >= -10: y -= (jumpCount ** 2) / 2 jumpCount -= 1 else: isJump = False jumpCount = 10 win.fill((0,0,0)) pygame.draw.rect(win, (0,0,255), (x, y, width, height)) pygame.display.update() pygame.quit() The post was merged to previous Aug 25, 2019 https://prnt.sc/ox9m7t The post was merged to previous Aug 25, 2019 Совет выучи python, хотя бы основы, а если знаешь закрепи у тебя есть проблемы!