#!usr/bin/python
#E.T Must Die 0.3
#(C) Doddy Hackman 2015
#Credits : Based on Bush Shootout.py Coded by Nathaniel
#Thanks to Nathaniel
import pygame
from pygame.locals import *
import sys,random,time
pygame.init()
juego = pygame.display.set_mode((860,640))
pygame.display.set_caption("E.T Must Die 0.3")
icono = pygame.image.load("Data/Images/icono.png").convert_alpha()
pygame.display.set_icon(icono)
pygame.mouse.set_visible(False)
letra = pygame.font.Font(None,35)
vida = 200
control = False
class mira(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.mira = pygame.image.load("Data/Images/mira.png")
self.rect = self.mira.get_rect()
self.rect.x = 860/2
self.rect.y = 640/2
def mover(self):
posicion = pygame.mouse.get_pos()
self.rect.x = posicion[0]
self.rect.y = posicion[1]
juego.blit(self.mira,self.rect)
def lanzar(self):
yeah = pygame.sprite.spritecollide(self,lista,dokill=False)
if yeah:
global vida
vida = vida - 10
pygame.mixer.Sound("Data/Sounds/risa2.wav").play()
class threat(pygame.sprite.Sprite):
def __init__(self):
pygame.sprite.Sprite.__init__(self)
self.imagen = pygame.image.load("Data/Images/avatar.png")
self.rect = self.imagen.get_rect()
self.tiempo = 15
self.contador = int(self.tiempo)
def mover(self):
self.contador += 1
if self.contador >= self.tiempo:
self.rect.x = random.randrange(20,850)
self.rect.y = random.randrange(30,540)
self.contador = 0
juego.blit(self.imagen,self.rect)
pygame.mixer.Sound("Data/Sounds/menu.wav").play()
men = pygame.image.load("Data/Images/portada.png")
juego.blit(men,(0,0))
pygame.display.update()
time.sleep(9)
pygame.mixer.init()
pygame.mixer.music.load("Data/Sounds/theme.mp3")
pygame.mixer.music.play()
mira = mira()
threat = threat()
lista = pygame.sprite.Group()
lista.add(threat)
cro = pygame.time.Clock()
mil = 0
while True:
mil += cro.tick()
casi = mil/1000
casi = 30 - casi
if casi < 1:
control = True
for acatoy in pygame.event.get():
if acatoy.type == QUIT:
sys.exit(1)
if acatoy.type == MOUSEBUTTONDOWN and acatoy.button == 1:
pygame.mixer.Sound("Data/Sounds/disparo.wav").play()
mira.lanzar()
if not control:
fondo = pygame.image.load("Data/Images/fondo.jpg")
juego.blit(fondo,(0,0))
juego.blit(letra.render("Remaining Time : "+str(casi),True,(255,0,0)),(20,10))
juego.blit(letra.render("Threat "+str(vida),True,(255,0,0)),(700,10))
mira.mover()
threat.mover()
if vida == 0:
over = pygame.image.load("Data/Images/ganaste.png")
juego.blit(over,(0,0))
pygame.display.update()
time.sleep(10)
sys.exit(1)
else:
over = pygame.image.load("Data/Images/perdiste.png")
juego.blit(over,(0,0))
pygame.display.update()
pygame.mixer.Sound("Data/Sounds/risa.wav").play()
time.sleep(10)
sys.exit(1)
pygame.time.delay(15)
pygame.display.flip()
#The End ?