python libraries for game development

Solutions on MaxInterview for python libraries for game development by the best coders in the world

showing results for - "python libraries for game development"
Luna
07 Aug 2016
1import pygame
2pygame.init()
3
4win = pygame.display.set_mode((500,500))
5pygame.display.set_caption("First Game")
6
7x = 50
8y = 50
9width = 40
10height = 60
11vel = 5
12
13run = True
14
15while run:
16    pygame.time.delay(100) # This will delay the game the given amount of milliseconds. In our casee 0.1 seconds will be the delay
17
18    for event in pygame.event.get():  # This will loop through a list of any keyboard or mouse events.
19        if event.type == pygame.QUIT: # Checks if the red button in the corner of the window is clicked
20            run = False  # Ends the game loop
21
22pygame.quit()  # If we exit the loop this will execute and close our game
23    
24
Eloi
29 Sep 2018
1python3 -m pip install pygame <<<(mac)>>>
2or
3python -m pip install pygame <<<(windows)>>>
4or
5sudo apt install python3-pygame <<<(ubuntu)>