-
Notifications
You must be signed in to change notification settings - Fork 1
/
1-ventana.py
22 lines (16 loc) · 995 Bytes
/
1-ventana.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pygame # Importa el módulo pygame
pygame.init() # Inicializa pygame
WIDTH = 800 # Anchura de la ventana
HEIGHT = 600 # Altura de la ventana
WIN = pygame.display.set_mode((WIDTH, HEIGHT)) # Crea la ventana
pygame.display.set_caption("Space Shooter") # Establece el título
def main(): # Función principal
jugando = True # Condición del bucle
while jugando: # Bucle del juego
for event in pygame.event.get(): # Obtiene los eventos y los recorre
if event.type == pygame.QUIT: # Evento QUIT
jugando = False # Salimos del bucle
pygame.quit() # Cerramos pygame
# Si han ejecutado directamente este archivo, lanzamos main()
if __name__ == "__main__":
main()