Un juego en 7 días
Alejandro J. Cura
[Team PyAr]
alecu@vortech.com.ar
Un juego en 7 días
pygame
pyweek
Team PyAr
Anuncio pyweek 2
From: <richard <at> pyweek.org>
Subject: PyWeek Python Game Programming Challenge, The Second!
Newsgroups: gmane.comp.python.announce
Date: 2006-02-24 21:59:52 GMT (24 weeks, 5 days, 13 hours and 55 minutes ago)
The date for the second PyWeek challenge has been set: Sunday 26th March
to Sunday 2nd April (00:00UTC to 00:00UTC).
The PyWeek challenge invites entrants to write a game in one week from
scratch either as an individual or in a team. Entries must be developed
in Python, during the challenge, and must incorporate some theme chosen
at the start of the challenge.
REGISTRATION IS NOW OPEN --
To register for the challenge, visit:
http://www.pyweek.org/
Some of the challenge website isn't finished yet. I hope to have it completed
in the next week. This includes management of team entries.
PLANNING FOR THE CHALLENGE --
Make sure you have working versions of the libraries you're going to use.
The rules page has a list of libraries and other resources.
Make sure you can build packages to submit as your final submission (if
you're going to use py2exe, make sure you know how to use it and that it
works).
If you don't have access to Linux, Windows or a Mac to test on, contact
friends, family or other competitors to find someone who is able to test
for you.
--
Visit the PyWeek website:
http://www.pyweek.org/
--
pyweek es:
Un desafío
votación de un "tema"
fecha límite
SIN PREMIOS FISICOS
animarse a hacer juegos
pyweek:
en una semana...
logica de cero
imagenes de cero
sonidos de cero
usar bibliotecas: si
Dynamite (pyweek 2005)
"Team PyAr"
mensaje en la lista
reclutando en una reunion
5 monos con muchas ganas :-)
y poca experiencia :-(
herramientas
¿Qué es pygame?
wrapper de SDL
linux, mac, win, etc
sprites (graficos 2d)
sonidos
mouse, teclado, joysticks
fonts, timer, etc
Juegos asi...
juegos asi...
o asi...
No me peguen!
(mini-juego)
nomepeguen.py
import pygame
#Inicializar pygame
pygame.init()
screen = pygame.display.set_mode((1024,768), pygame.FULLSCREEN)
clock = pygame.time.Clock()
#Cargar recursos
giordano, mano = [pygame.image.load(f) for f in 'giordano-torso.png', 'mano.png']
giordano.set_colorkey((0,255,0), pygame.RLEACCEL)
mano.set_colorkey((0,255,0), pygame.RLEACCEL)
sonidoGolpe, sonidoErrado = [pygame.mixer.Sound(f) for f in "punch.wav", "whiff.wav"]
font = pygame.font.Font("VeraBd.ttf", 48)
titulo = font.render("No me peguen!", 1, (255,255,255))
rPantalla = screen.get_rect()
#Inicializar simulacion
posicion = giordano.get_rect().centerx + 5
velocidad, distancia = 15, 0
golpe, jugando = False, True
#Repetir:
while jugando:
clock.tick(30)
#1) Procesar acciones del jugador
for event in pygame.event.get():
if event.type == pygame.QUIT:
jugando = False
elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
jugando = False
if event.type == pygame.MOUSEBUTTONDOWN:
golpe = True
#2) Avanzar simulacion
rMano = mano.get_rect(center=pygame.mouse.get_pos())
if distancia > 4: distancia -= 4
rMano.centery = rPantalla.centery + 30 - distancia
golpeado = False
colorFondo = (255*distancia/30.0,0,0)
rGiordano = giordano.get_rect(center=(posicion, rPantalla.centery))
if golpe:
rGolpe = mano.get_rect(center=rMano.center)
rGolpe.centery = rPantalla.centery - 5
rGolpe.inflate_ip(-5,-5)
golpeado = rGolpe.colliderect(rGiordano.inflate(-30,-30))
if golpeado:
sonidoGolpe.play()
colorFondo = (255,0,0)
else:
sonidoErrado.play()
distancia = 30
golpe = None
if not rPantalla.contains(rGiordano):
rGiordano.clamp_ip(rPantalla)
velocidad = -velocidad
giordano = pygame.transform.flip(giordano, 1, 0)
posicion += velocidad
#3) Dibujar estado actual
screen.fill(colorFondo)
screen.blit(titulo, titulo.get_rect(midtop=screen.get_rect().midtop))
screen.blit(giordano, rGiordano)
screen.blit(mano, rMano)
pygame.display.flip()
Recursos
Recursos
Bucle pygame
Inicializar pygame
Cargar recursos
Inicializar simulacion
Repetir:
1-Procesar acciones del jugador
2-Avanzar simulacion
3-Dibujar estado actual
Inicializar
import pygame
#Inicializar pygame
pygame.init()
screen = pygame.display.set_mode((1024,768), pygame.FULLSCREEN)
clock = pygame.time.Clock()
#Cargar recursos
giordano, mano = [pygame.image.load(f) for f in 'giordano-torso.png', 'mano.png']
giordano.set_colorkey((0,255,0), pygame.RLEACCEL)
mano.set_colorkey((0,255,0), pygame.RLEACCEL)
sonidoGolpe, sonidoErrado = [pygame.mixer.Sound(f) for f in "punch.wav", "whiff.wav"]
font = pygame.font.Font("VeraBd.ttf", 48)
titulo = font.render("No me peguen!", 1, (255,255,255))
#Inicializar simulacion
posicion = giordano.get_rect().centerx + 5
velocidad, distancia = 15, 0
golpe, jugando = None, True
1-Procesar acciones
#Repetir:
while jugando:
clock.tick(30)
#Procesar acciones del jugador
for event in pygame.event.get():
if event.type == pygame.QUIT:
jugando = False
elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
jugando = False
if event.type == pygame.MOUSEBUTTONDOWN:
golpe = pygame.mouse.get_pos()
rPantalla = screen.get_rect()
2-Avanzar simulacion
#Avanzar simulacion
golpeado = False
colorFondo = (255*distancia/30.0,0,0)
rGiordano = giordano.get_rect(center=(posicion, rPantalla.centery))
if golpe:
rGolpe = mano.get_rect(center=golpe)
rGolpe.centery = rPantalla.centery - 5
rGolpe.inflate_ip(-5,-5)
golpeado = rGolpe.colliderect(rGiordano.inflate(-30,-30))
if golpeado:
sonidoGolpe.play()
colorFondo = (255,0,0)
else:
sonidoErrado.play()
distancia = 30
golpe = None
if not rPantalla.contains(rGiordano):
rGiordano.clamp_ip(rPantalla)
velocidad = -velocidad
giordano = pygame.transform.flip(giordano, 1, 0)
posicion += velocidad
rMano = mano.get_rect(center=pygame.mouse.get_pos())
if distancia > 0: distancia -= 4
rMano.centery = rPantalla.centery + 30 - distancia
3-Dibujar estado actual
#Dibujar estado actual
screen.fill(colorFondo)
screen.blit(titulo, titulo.get_rect(midtop=screen.get_rect().midtop))
screen.blit(giordano, rGiordano)
screen.blit(mano, rMano)
pygame.display.flip()
No me peguen!
(mini-juego)
herramientas: PGU
editor de tiles
editor de niveles
motor de tiles
gui sobre pygame
Editor de tiles
Editor de niveles
Editor de niveles (iso)
Arranca pyweek
semana previa: temas
Someone else's trash
Doorways
A fraction too much friction
Mind the gap
It runs on steam!
"It runs on steam!"
semana pyweek
un primer sprint
separando las tareas
una semana sin dormir
un sprint final
http://pyweek.org/e/PyAr/
A virtual machine?
A compiler?
A graphical ide?
Steam powered?
Are you sure it's still a game?
Announcing "S.T.I.M."
the vaporware game that will leave you
asking even more questions...
Is it turing complete?
You'll have to find out for yourself!!!
--
The Python Users Group from Argentina.
STIM
armar una computadora
a vapor
una computadora a vapor
STIM: entrañas
STIM: entrañas
pyweek semanas +1 y +2:
puntaje a cada juego:
innovación
producción
diversión
Los competidores
Los ganadores
Nelly's Rooftop Garden
Nelly's Rooftop Garden
Trip on the funny boat
Lecciones aprendidas
un juego para la tia bibi
psicologia del juego
recortar features
Interludio
pygame.draw 64k
un solo archivo .py
"human readable"
sin archivos externos
sin .PNGs, sin .OGGs
sólo usando pygame
alocador.py
62684 bytes
alocador
ubicar procesos
en memoria
antes que el usuario
pierda la paciencia
alocado alocador
diagrama alocador
diagrama alocador
TinySynth
un sintetizador análogo
9915 bytes
Generación de sonido
Ejemplo de Partitura
ateam = """
D#:4 A#:2:-1 D#:8 -:2
G#:2:-1 A#:4:-1 D#:6:-1 -:2 G:1:-1 A:1:-1
D#:2 A#:2:-1 F:2 D#:8 -:2
C#:3 C:1 A#:1:-1 G#:3:-1 A#:8:-1
D#:3 D#:1 A#:2:-1 D#:8 -:2
G:2:-1 G#:2:-1 F:2:-1 A#:2:-1 D#:8:-1
F#:3:-1 G#:1:-1 C:2 C#:24 -:2
C#:2 C:2 -:2 G#:2:-1 C#:4 C:4
G:3:-1 G#:1:-1 A#:2:-1 D#:8 -:2
A#:2:-1 G#:2:-1 -:2 D#:2:-1 A#:4:-1 G#:4:-1
G#:2:-1 G:2:-1 D#:2:-1 D:2:-1 D#:8:-1
-:16
D#:4 A#:4:-1 D#:8 -:2
G#:2:-1 A#:4:-1 D#:6:-1 -:2 G:1:-1 A:1:-1
D#:2 A#:2:-1 F:2 D#:8 -:2
C#:3 C:1 A#:1:-1 G#:3:-1 A#:8:-1
D#:3 D#:1 A#:2:-1 D#:8 -:2
G:2:-1 G#:2:-1 F:2:-1 A#:2:-1 D#:8:-1
G#:2:-1 G:4:-1 D#:2:-1 G#:4:-1 G:4:-1
G#:4:-1 A#:4:-1 C:2 D:6
D#:4
"""
TinySynth
El futuro
El futuro
ActionSprite++
Fisica con ODE, 3d
ZUI (2 1/2D) c/GL
numpy p/matrices y sonidos
Fisica con ODE
Anuncio pyweek 3
From: <richard <at> pyweek.org>
Subject: PyWeek #3 in September!
Newsgroups: gmane.comp.python.announce, gmane.comp.python.pygame
Date: 2006-08-04 01:48:15 GMT (1 week, 6 days, 10 hours and 12 minutes ago)
PyWeek 3 is coming up. I've scheduled it for the first week of September. The
exact dates are 00:00UTC Sunday 3rd September to 00:00UTC Sunday 10th
September.
REGISTRATION IS NOW OPEN
Visit the PyWeek website to sign up:
http://www.pyweek.org/
THE PYWEEK CHALLENGE:
- Invites all Python programmers to write a game in one week from scratch
either as an individual or in a team,
- Is intended to be challenging and fun,
- Will hopefully increase the public body of python game tools, code and
expertise,
- Will let a lot of people actually finish a game, and
- May inspire new projects (with ready made teams!)
Entries must be developed during the challenge, and must incorporate some
theme decided at the start of the challenge. The rules for the challenge are
at:
http://media.pyweek.org/static/rules.html
Richard
--
Visit the PyWeek website:
http://www.pyweek.org/
--
¿Preguntas?
http://alecu.com.ar/juegos
alecu@vortech.com.ar
Links
http://pygame.org/
http://www.pyweek.org/
http://alecu.com.ar/juegos