[Python-Pygame] E.T Must Die 0.3

Iniciado por BigBear, Enero 01, 2015, 11:50:22 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Un simple shooter que hice en Python usando Pygame , el juego consiste en eliminar la amenaza de E.T antes de que escape de nuestro planeta.
Es un juego raro pero me sirvio para estudiar el tema de programacion de juegos en Python xD.

Una imagen :



Un video de como se juega :



El codigo :

Código: python

#!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 ?


Si quieren bajar el juego lo pueden hacer de No tienes permitido ver los links. Registrarse o Entrar a mi cuenta.

requerimientos minimos de sistema y hardware? xDDD

naa es broma, muy bueno doddy, le hecharé un ojo :)

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta

Acepta con humildad y aprecio que en la vida la muerte es inevitable y amarás ésta, adorando la muerte

Para un juego de 125 lineas de codigo seria :

4 GB de RAM
1 GB  de placa de video , te recomiendo la ATI Radeon HD 5450
20 GB de espacio en el disco duro

Saludos.

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Para un juego de 125 lineas de codigo seria :

4 GB de RAM
1 GB  de placa de video , te recomiendo la ATI Radeon HD 5450
20 GB de espacio en el disco duro

Saludos.

:O

Tan poco? que bien has optimizado el juego!  ;D ;D

Gran aporte, voy a ver el código debe de ser muy interesante.

Un saludo.



No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Tan poco? que bien has optimizado el juego!  ;D ;D

Si , es que queria rivalizar con el GTA IV.

Si tengo Python 2.7 64bit no funciona?

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Si tengo Python 2.7 64bit no funciona?

deberia , pero no lo eh probado.

No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
No tienes permitido ver los links. Registrarse o Entrar a mi cuenta
Si tengo Python 2.7 64bit no funciona?

deberia , pero no lo eh probado.

Tuve que instalar Python 2.7 de 32bits y solucionado.
Cambie self.tiempo = 200 para facilitarme las cosas jeje
Bien hecho colega!  8)