Example #1
0
    # event loop
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
        if (event.type == pygame.MOUSEBUTTONDOWN
                and pygame.mouse.get_pos()[1] > windowInfo.inputHeight):
            accumulatedTime = pygame.time.get_ticks()
            location.resetX(pygame.mouse.get_pos()[0])
            location.resetY(pygame.mouse.get_pos()[1])
        velocityInput.runInputBox(event)
        angleInput.runInputBox(event)

    if location.getCurrentY() < windowInfo.groundHeight - projectile.width:
        location.calculateLocation(
            projectile, (pygame.time.get_ticks() - accumulatedTime) / 1000,
            environment)

    if velocityInput.isValueConfirmed:
        try:
            projectile.setVelocity(int(velocityInput.content))
        except:
            print("please enter an integer")

    if angleInput.isValueConfirmed:
        try:
            projectile.setAngle(int(angleInput.content))
        except:
            print("please enter an integer")
    drawGameWindow()
pygame.quit()