Загрузка...

Help with else error

Thread in Python created by ByteMinerR4 Aug 20, 2019. 379 views

  1. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    Code
    else:
    if jumpCount >= -10
    y -= (jumpCount ** 2) / 2
    jumpCount -= 1

    else:
    isJump = False
    jumpCount = 10
    что тут не так и почему выдает ошибку:
    else:
    ^
    IndentationError: unexpected indent
     
  2. DumBler
    DumBler Aug 20, 2019 Добрый человек 84 Apr 5, 2018
    Могу ошибаться, но вроде бы много пробелов после первого else
     
  3. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    это на форуме так отоброжается, на самом деле они на одном уровне
     
  4. oriole
    oriole Aug 20, 2019 был(а) давно
    после if двоеточие поставь
     
  5. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    после всех?
    The post was merged to previous Aug 20, 2019
    найс уже другая ошибка
    keys = pygame.key.get_pressed()
    ^
    IndentationError: unindent does not match any outer indentation level
     
  6. oriole
    oriole Aug 20, 2019 был(а) давно
    Code
    if jumpCount >= -10:
     
  7. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    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
    сразу весь код скинул
     
  8. oriole
    oriole Aug 20, 2019 был(а) давно
    Code
    else:
    isJump = False
    jumpCount = 10


    win.fill((0,0,0))
    win не на одном уровне, добавь пробел
     
  9. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    я по гайду делал.
     
  10. thekorol
    thekorol Aug 20, 2019 1495 Apr 5, 2016
    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()
     
  11. ByteMinerR4
    ByteMinerR4 Topic starter Aug 20, 2019 Sell ByteCoin. Выгодно. 4 Aug 9, 2019
    сука все переписал и все равно не работает
    The post was merged to previous Aug 20, 2019
    :forsenGun::what2:
    The post was merged to previous Aug 20, 2019
    господи дай тебе здоровья твой код подошел благодарю просто от души:press_f::press_f::press_f::press_f::press_f:
    The post was merged to previous Aug 20, 2019
    блять ты мне код сломал теперь там одна функция не робит пиздос чо делать:pepeSuicide2::pepeSuicide2::pepeSuicide2:
     
  12. Kyber_Zero
    Kyber_Zero Aug 25, 2019 Dead Inside 5 Jan 21, 2018
    ByteMinerR4, Либо программирование не твоё - либо ты рофлишь)0)0
     
  13. Delitel
    Delitel Aug 25, 2019 198 Feb 4, 2018
    Ошибка в отступе, сделай правильную табуляцию!
    The post was merged to previous Aug 25, 2019
    Всё работает ! https://prnt.sc/ox9kx9
    The post was merged to previous Aug 25, 2019
    Вот код
    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, хотя бы основы, а если знаешь закрепи у тебя есть проблемы!
     
Loading...
Top