1
0

main.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import pygame, sys
  2. from pygame.locals import * # Import des constantes de pygame
  3. from world import *
  4. from variables import *
  5. from player import *
  6. from nest import *
  7. def main():
  8. """La fonction pricipale"""
  9. ### Initialmisation ###
  10. pygame.init() # La fonction secrète, on sait pas ce qu'elle fait mais elle doit être là
  11. display = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) # Taille de la fenêtre
  12. display.fill(BACKGROUND_COLOR)
  13. pygame.display.set_caption("VISI301") # Nom de la fenêtre, à changer à la fin TODO
  14. # Création du monde
  15. world = World(display, NB_COL, NB_ROW, GAP)
  16. world.draw()
  17. player = Player(0, 0, display)
  18. player.draw(world.pos_list[1]) #Le choix de la tuile a été arbitraire
  19. nest = Nest(0, display)
  20. nest.draw(world.pos_list[0], 0)
  21. ### Boucle principale ###
  22. while True:
  23. # À chaque tick on fait ce qu'il y a là
  24. # create_world(display, NB_COL, NB_ROW, GAP)
  25. for event in pygame.event.get():
  26. # On fait des trucs
  27. # Fermeture du jeu
  28. if event.type == QUIT:
  29. pygame.quit()
  30. sys.exit()
  31. pygame.display.update()
  32. # On quitte pygame
  33. pygame.quit()
  34. # On lance la fonction principale
  35. main()