Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def show_intro(app):
- # press any button to start animation
- key_not_pressed = True
- label = pygame.image.load('intro/label.png')
- logo = pygame.image.load('intro/logo.bmp')
- label_height = 59
- label_width = 439
- logo_x = (SCREEN_RES[0] - logo_width) // 2
- logo_y = (SCREEN_RES[1] - bar_height - logo_height) // 2
- x = (SCREEN_RES[0] - label_width) // 2
- y = (SCREEN_RES[1] - label_height) - bar_height*2
- velocity = 1
- animation_frame_rate = 30
- top_border = (SCREEN_RES[1] - label_height) - bar_height*2
- bottom_border = (SCREEN_RES[1] - label_height) - bar_height - 10
- moving_down = True
- while key_not_pressed:
- app.clock.tick(animation_frame_rate)
- for event in pygame.event.get():
- if event.type == pygame.QUIT:
- pygame.quit()
- sys.exit(0)
- elif event.type == pygame.KEYUP:
- key_not_pressed = False
- pygame.draw.rect(app.win, color_green_light, (0, 0, SCREEN_RES[0], SCREEN_RES[1]))
- app.win.blit(logo, (logo_x, logo_y))
- if moving_down:
- y += velocity
- if y >= bottom_border:
- moving_down = False
- else:
- y -= velocity
- if y <= top_border:
- moving_down = True
- app.win.blit(label, (x, y))
- pygame.display.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement