albertohilal

Clase 10 Ejemplo 3.2

Oct 16th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import pygame
  2. import sys
  3. BLANCO = (255, 255, 255)
  4. ROJO = (255, 0, 0)
  5. MEDIDA_PANTALLA = (640, 480)
  6. def Pelota(pantalla, posicion):
  7. pygame.draw.circle(pantalla, ROJO, posicion, 50)
  8. def DibujarPantalla(pantalla, estado):
  9. Pelota(pantalla, estado)
  10. def actualizarEstado(estado): # Mantenemos el estado anterior
  11. return estado
  12. def EjecutarCiclo():
  13. estado = (320, 240)
  14. pygame.init()
  15. pantalla = pygame.display.set_mode( MEDIDA_PANTALLA )
  16. reloj = pygame.time.Clock()
  17. while True:
  18. estado = actualizarEstado(estado)
  19. pantalla.fill(BLANCO)
  20. DibujarPantalla(pantalla, estado)
  21. pygame.display.flip()
  22. tick = reloj.tick(60)
  23. if __name__ == "__main__":
  24. EjecutarCiclo()
  25. X = 0
  26. Y = 1
  27. def actualizarEstado(estado):
  28. return (estado[0], estado[1] + 1)
Advertisement
Add Comment
Please, Sign In to add comment