Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Juego.py
diff options
context:
space:
mode:
Diffstat (limited to 'Juego.py')
-rwxr-xr-xJuego.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/Juego.py b/Juego.py
index 3edd7d3..e02860c 100755
--- a/Juego.py
+++ b/Juego.py
@@ -8,6 +8,7 @@ import pygame
from pygame.locals import *
from Jugador import Jugador
+from Nave import Bala
Ancho = 1024
Alto = 600
@@ -85,6 +86,8 @@ class Juego():
self.eventos()
self.naves.update()
+ self.balas.update()
+ self.explosiones.update()
pygame.event.clear()
self.naves.draw(self.ventana)
@@ -102,6 +105,25 @@ class Juego():
pygame.quit()
sys.exit(0)
-
+ if tecla[pygame.K_UP]:
+ if self.protagonista.nave.rect.y - 5 > 0:
+ self.protagonista.nave.rect.y -= 5
+
+ if tecla[pygame.K_DOWN]:
+ if self.protagonista.nave.rect.y + self.protagonista.nave.rect.h + 5 < self.protagonista.nave.h:
+ self.protagonista.nave.rect.y += 5
+
+ if tecla[pygame.K_RIGHT]:
+ if self.protagonista.nave.rect.x + self.protagonista.nave.rect.w + 5 < self.protagonista.nave.w:
+ self.protagonista.nave.rect.x += 5
+
+ if tecla[pygame.K_LEFT]:
+ if self.protagonista.nave.rect.x - 5 > 0:
+ self.protagonista.nave.rect.x -= 5
+
+ if tecla[pygame.K_SPACE]:
+ bala = Bala(self.protagonista)
+ self.balas.add(bala)
+
if __name__ == "__main__":
Juego()