Ver Mensaje Individual
  #3 (permalink)  
Antiguo 20/05/2010, 12:57
Avatar de pato12
pato12
 
Fecha de Ingreso: septiembre-2007
Ubicación: Salta
Mensajes: 1.620
Antigüedad: 16 años, 7 meses
Puntos: 101
Respuesta: [APORTE] Un juego

Código Python:
Ver original
  1. pintar_fondo_default('img/fondo_menu.png')      
  2.           if pygame.key.get_pressed()[K_e] or pygame.key.get_pressed()[K_RETURN]:
  3.              if _opcion_elejida == 1:
  4.                 _bluce_principal=0
  5.                 return
  6.              if _opcion_elejida == 2:
  7.                 _bluce_principal=0
  8.                 main_menu_game()
  9.                 return
  10.                
  11.           if pygame.key.get_pressed()[K_a] or pygame.key.get_pressed()[K_LEFT]:
  12.              if _opcion_elejida==1:
  13.                 _opcion_elejida=2
  14.              else:
  15.                 _opcion_elejida=1
  16.           if pygame.key.get_pressed()[K_d] or pygame.key.get_pressed()[K_RIGHT]:
  17.              if _opcion_elejida==2:
  18.                 _opcion_elejida=1
  19.              else:
  20.                 _opcion_elejida=2
  21.          
  22.           if _opcion_elejida == 1:
  23.              screen.blit(opciones['activado']['si'],(8,290))
  24.              screen.blit(opciones['desactivado']['no'],(90,290))
  25.           if _opcion_elejida == 2:
  26.              screen.blit(opciones['desactivado']['si'],(10,290))
  27.              screen.blit(opciones['activado']['no'],(87,290))
  28.              
  29.           screen.blit(titulo_img, (30,50))
  30.           screen.blit(pregunta,(0,195))
  31.           pygame.display.flip()      
  32.                
  33. def main_menu_game(primero=False):
  34.     titulo_img = load_image('img/titulo.png',-1)
  35.     titulo_juego_ir=50
  36.     _bluce_principal=1
  37.     if primero:
  38.        titulo_juego_ir=-100
  39.        while (titulo_juego_ir <= 50):
  40.              for event in pygame.event.get():
  41.                  if event.type == QUIT:
  42.                     titulo_juego_ir=51
  43.                     salir_confirmar()
  44.                     return
  45.              pintar_fondo_default()
  46.              titulo_juego_ir=titulo_juego_ir+10
  47.              screen.blit(titulo_img, (30,titulo_juego_ir))
  48.              pygame.display.flip()
  49.     SpriteSheet_menu = SpriteSheet('img/opciones_menu.png')
  50.    
  51.     opciones_img={"activo":
  52.                           {
  53.                           "jugar":SpriteSheet_menu.imgat((0,1,100,45),-1),
  54.                           "puntaje":SpriteSheet_menu.imgat((0,45,140,45),-1),
  55.                           "salir":SpriteSheet_menu.imgat((-1,90,70,45),-1)
  56.                           },
  57.                   "desactivo":
  58.                           {
  59.                           "jugar":SpriteSheet_menu.imgat((209,0,100,45),-1),
  60.                           "puntaje":SpriteSheet_menu.imgat((162,45,140,45),-1),
  61.                           "salir":SpriteSheet_menu.imgat((228,90,76,46),-1)
  62.                           }
  63.                   }
  64.     _opcion_elejida=1
  65.     while _bluce_principal:
  66.           for event in pygame.event.get():
  67.               if event.type == QUIT:
  68.                  _bluce_principal=0
  69.                  salir_confirmar()
  70.                  return
  71.           pintar_fondo_default('img/fondo_menu.png')
  72.          
  73.           if pygame.key.get_pressed()[K_w] or pygame.key.get_pressed()[K_UP]:
  74.              if _opcion_elejida == 1:
  75.                 _opcion_elejida=3
  76.              else:
  77.                 _opcion_elejida=_opcion_elejida-1
  78.                
  79.           if pygame.key.get_pressed()[K_s] or pygame.key.get_pressed()[K_DOWN]:
  80.              if _opcion_elejida == 3:
  81.                 _opcion_elejida=1
  82.              else:
  83.                 _opcion_elejida=_opcion_elejida+1
  84.          
  85.           if pygame.key.get_pressed()[K_e] or pygame.key.get_pressed()[K_RETURN]:
  86.              if _opcion_elejida == 3:
  87.                 _bluce_principal=0
  88.                 salir_confirmar()
  89.              if _opcion_elejida == 2:
  90.                 _bluce_principal=0
  91.                 puntajes_mostrar()
  92.              if _opcion_elejida == 1:
  93.                 _bluce_principal=0
  94.                 game_goo()
  95.                 return
  96.          
  97.           if _opcion_elejida == 1:
  98.              screen.blit(opciones_img['activo']['jugar'],(50,210))
  99.              screen.blit(opciones_img['desactivo']['puntaje'],(50,255))
  100.              screen.blit(opciones_img['desactivo']['salir'],(50,300))
  101.           if _opcion_elejida == 2:
  102.              screen.blit(opciones_img['desactivo']['jugar'],(50,210))
  103.              screen.blit(opciones_img['activo']['puntaje'],(50,255))
  104.              screen.blit(opciones_img['desactivo']['salir'],(50,300))
  105.           if _opcion_elejida == 3:
  106.              screen.blit(opciones_img['desactivo']['jugar'],(50,210))
  107.              screen.blit(opciones_img['desactivo']['puntaje'],(50,255))
  108.              screen.blit(opciones_img['activo']['salir'],(50,300))
  109.          # screen.blit(opciones_img['activo']['salir'],(50,155))
  110.           screen.blit(titulo_img, (30,titulo_juego_ir))
  111.           escribir_game('Juego desarrollado por Pato12 - halfmusic.com',15,(255,255,255),0,583)
  112.           pygame.display.flip()
  113.            
  114.          
  115. if __name__ == "__main__":                  
  116.    main_menu_game(True)
  117.    coneccion.commit()
  118.    cursor.close()
  119.    coneccion.close()
Aquí pueden encontrar las imágenes y el juego andando: http://www.mediafire.com/?twtztvgd2t1

Cualquier sugerencia es aceptada..

Gracias
Saludos

EDITO:
Me olvide de decir, que usa pygame y sqlite3 :P
__________________
Half Music - www.halfmusic.com

Última edición por pato12; 20/05/2010 a las 13:07 Razón: aclarar que usa pygame y sqlite3