Facebook
From asdasd, 1 Week ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 83
  1. #pgzero
  2.  
  3. import random
  4.  
  5. WIDTH = 600
  6. HEIGHT = 400
  7.  
  8. TITLE = "Viaje Espacial"
  9. FPS = 30
  10.  
  11. fondo = Actor("space")
  12. nave = Actor("ship",(300,370))
  13.  
  14. lista_enemigos = []
  15.  
  16. for i in range(5):
  17.    
  18.     enemigo = Actor("enemy",(random.randint(0,600) , 50 ))
  19.     lista_enemigos.append(enemigo)    
  20.    
  21. def draw():
  22.     fondo.draw()
  23.     nave.draw()
  24.     screen.draw.text("VIAJE ESPACIAL",(130,100),fontsize=40)
  25.    
  26.     for i in range(len(lista_enemigos)):
  27.         lista_enemigos[i].draw()
  28.    
  29.  
  30. def movimiento_naves():
  31.    
  32.     for i in range(len(lista_enemigos)):
  33.         if lista_enemigos[i].y < 450:
  34.             lista_enemigos[i].y = lista_enemigos[i].y + 5  
  35.    
  36.    
  37. def update(dt):
  38.     movimiento_naves()
  39.    
  40. def on_mouse_move(pos):
  41.     nave.pos = pos