
bTc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z e j j e j j e   Z	 d   Z
 e  j j d e
 d   e  j j d e
 d   d  d l m Z d  d l Z d  d l Z e j j   d  d l Z d  d l m Z m Z d  d l Z d  d l Z d( Z d) Z d
   Z d   Z e
 d  Z e
 d  Z g  a d a e d  Z d   Z  d   Z! d   Z d e j" f d     YZ# d e j" f d     YZ$ d e j% f d     YZ& d e j" f d     YZ' d e j" f d     YZ( d e j" f d     YZ) d e j" f d      YZ* d! e j+ f d"     YZ, d# e j- f d$     YZ. d%   Z/ e0 d& k re j1 j e d' e2 e/   e j1 j3   n  d S(*   iNc         C   s   t  j j t |   S(   N(   t   ost   patht   joint   game_dir(   t   archivo(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   gamedir   s    i   s
   ../../Lib/s   ../../(   t   decir(   t	   randranget   randinti  i@   c         C   s   t  j s |  j   n  d  S(   N(   t   Escenat   MUTEt   play(   t   res(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   /   s    	c         C   s   |  j    } g  } d } xn | D]f } t |  t |  | k rW | j |  d } n  | | d } | | d k r | j |  q q Wd j |  S(   s2   
    Sirve para cortar texto en varias lineas
    t    t    is   
(   t   splitt   lent   appendR   (   t   textt   lengtht   wordst   linest   linet   w(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   wrap3   s    	s   ../fonts/DejaVuSans.ttfs   ../../Topics/Topic_3/i    c         C   s   t  s] t j j |  d  } t j t |   } x | D] } t  j |  q7 Wt t   a	 n  t
 j d t t   d  } t  | d } t  | d } t j j |  d | d  } t  j |  | | f S(   Ns   vocabulario.csvi    i   t   termt   idt   Imageness   .png(   t   VOCABULARIOR    R   R   t   csvt
   DictReadert   fileR   R   t   CANT_PALABRASt   randomR   t   pop(   t	   topic_dirR   t   tablat   lineat   indicet   palabrat   uidt   palabra_png(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   obtener_palabraJ   s    c           C   s   g  a  d a d  S(   Ni    (   R   R    (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   reset_vocabulario^   s    c         C   sN   t    } x> t |  d k  rI t |   } | | k r | j |  q q W| S(   Ni   (   t   listR   R*   R   (   t   topict   conjuntot   nueva(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   obtener_setc   s    	c         C   s   t  j s |  j   n  d  S(   N(   R	   R
   R   (   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   k   s    	t   CampodeEstrellasc           B   sq   e  Z d    Z d   Z d d  Z d   Z d   Z d   Z d   Z e	 d  Z
 d	   Z d
   Z d   Z RS(   c         C   s+  t  j j |  |  d |  _ d |  _ d |  _ d |  _ t  j | j  d |  _	 d |  _
 d |  _ t |  _ d |  _ d |  _ d	 |  _ t  j d
 d  j |  j |  j |  j f  |  _ |  j   |  j   t  j j d |  j  t  j j d |  j  t d  |  _ d |  j _ t  j j d |  j  d  S(   Ni   i   t   abajog?i   t   centert   bigbangi    i0   t   sizei  s   director.updates   director.pre_updatei   t   demoras%   CampodeEstrellas.demora.animation.end(   i  i  (   t   spyralt   Spritet   __init__t	   num_starst	   max_deptht   layert   speedt   Vec2DR5   t   post   anchort   ESTADOt   Falset   gonet   Rt   Gt   Bt   Imaget   fillt   imaget
   init_starst   init_animationst   eventt   registert   updatet   predrawt   DelayAnimationt   delayt   propertyt   spawn(   t   selft   scene(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9   p   s(    										0

c         C   s   t  j j d |  j  d  S(   Ns%   CampodeEstrellas.demora.animation.end(   R7   RL   t
   unregisterRS   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   forget   s    i   c         C   sS   |  j  d k sO |  j } | r6 t |  } d | _ n  |  j |  d |  _  n  d  S(   Nt   volandoR6   (   RA   RQ   RP   RR   t   animate(   RT   t   secsRQ   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   defered_spawn   s    	c         C   s)   |  j  s% |  j j j   d |  _ n  d  S(   Nt
   emergencia(   RC   RU   t   navet   resetRA   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRS      s    	c         C   sv  d |  _  d |  _ t j d t j j |  j  |  j  d d |  _ t j d t j j |  j |  j   d d |  _ t j d t j j	 d d  d d	 t j d
 t j j d d  d d @t j d t j j d d  d d |  _
 d |  j
 _ t j d t j j	 d d  d d t j d t j j	 d d  d d	 @t j d
 t j j	 d d  d d @|  _ d |  j _ t j d t j j	 d d  d d t j d t j j	 d d  d d @t j d
 t j j	 d d  d d @|  _ d |  j _ t j d t j j	 d d  d d t j d t j j	 d d  d d	 @t j d
 t j j	 d d  d d	 @|  _ d |  j _ d  S(   Ng333333?gQ?R=   t   durationi   RE   i    i    i   RF   iP   RD   i   t   turnredi   t   turnbluei   i   i(   t   goodbye(   t   topt   lowR7   t	   Animationt   easingt   CubicOutt   slowdown_animt   QuadraticOutt   speedup_animt   Lineart   turnred_animRR   t   turnblue_animt   turnblue_alt_animt   goodbye_anim(   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRK      s&    			'	'$%+I+I+I+c         C   sb   |  j    |  j    |  j |  j  t j d t j j |  j |  j  d d } |  j |  d  S(   NR=   R_   i   (	   t   stop_all_animationsRY   Ro   R7   Re   Rf   Rk   R=   Rc   (   RT   t   a(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRb      s    

	$c         C   s   |  j    |  j    | r- |  j |  j  n |  j |  j  y |  j |  j  WnU t k
 r |  j    t j d t j j	 |  j
 |  j  d d } |  j |  n Xd  S(   NR=   R_   i   (   Rp   RY   Rn   Rm   Rj   t
   ValueErrorR7   Re   Rf   Rk   R=   Rc   (   RT   t   resultRq   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   speedup   s    


	$c         C   sO  | r y |  j  |  j  Wq t k
 r |  j   |  j   t j d t j j |  j d  d d t j d t j j |  j	 d  d d @t j d t j j |  j
 d  d d @} d	 | _ |  j  |  q Xn  y |  j  |  j  Wn_ t k
 rJ|  j   |  j   t j d
 t j j |  j |  j  d d } |  j  |  n Xd  S(   NRD   i   R_   i   RE   i    RF   i    R`   R=   i   (   RY   Rl   Rr   Rp   R7   Re   Rf   Rk   RD   RE   RF   RR   Rh   R=   Rd   (   RT   t   colorRq   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   slowdown   s$    

O+	

	$c   	      C   s{  |  j  d } |  j d } xZ|  j D]O} | d c |  j 8<| d d k r t d d  | d <t d d  | d <|  j | d <n  d | d } t | d | |  } t | d | |  } d | k o |  j  k  n r$ d | k o |  j k  n r$ d t | d  |  j d } d t | d  |  j d } |  j j	 | d | d | f | | f t |   q$ q$ Wd	 S(
   s    Move and draw the stars i   i    ii   i   g      `@i   i   N(
   t   widtht   heightt   starsR=   R   R;   t   intt   floatRI   t   draw_circle(	   RT   t   origin_xt   origin_yt   start   kt   xt   yR5   t   shade(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRN      s    >c         C   s&   |  j  j |  j |  j |  j f  d  S(   N(   RI   RH   RD   RE   RF   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRO     s    c         C   sd   g  |  _  xT t |  j  D]C } t d d  t d d  t d |  j  g } |  j  j |  q Wd S(   s    Create the starfield ii   i   N(   Ry   t   rangeR:   R   R;   R   (   RT   t   iR   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRJ     s    	-(   t   __name__t
   __module__R9   RW   R[   RS   RK   Rb   Rt   t   TrueRv   RN   RO   RJ   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR1   o   s   									t   Bloquec           B   s;   e  Z d  d d  Z d   Z d   Z d   Z d   Z RS(   s   The Chakana Crossc         C   s   t  j j |  |  d |  _ | |  _ | |  _ t  j t d d
  |  _ |  j j	 |  _
 d |  _ d |  _ d |  _ t  j d t d   |  _ |  j |  _ t  j | j  d	 |  _ |  j   d  S(   Nt   arribai   i    t   TARJETAR3   i   t   filenames   imagenes/marco_1.pngi   (   i    i    i    (   R7   R8   R9   R<   t   PALABRAt   ARCHIVOt   Fontt	   font_patht   fontt   linesizet   line_heightt   modeR@   t   marginRG   R   t   marcoRI   R>   R5   R?   t   showself(   RT   RU   R   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9     s    						c         C   s    | |  _  | |  _ |  j   d  S(   N(   R   R   R   (   RT   R   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   set_word4  s    		c   
      C   s  |  j  j d  d } |  j d |  j | } t | |  j   } t |  |  j } t j	 d |  j | f  } d } xM | D]E } | j
 d |  j  j |  d d | |  j f d d  | d	 } q~ Wt j	 d |  j |  j |  j |  j f  j d  }	 |	 j
 | d d d d |	 S(   Nt   Xi    i   R5   RI   t   positionR@   t   midtopi   i   t   midleft(   i   i   i   (   i    i    (   R   t   get_sizeRw   R   R   t
   splitlinesR   R   R7   RG   t
   draw_imaget   renderRx   RH   (
   RT   R   t   ancho_promediot
   caracterest   lineast   alturat   bloquet   lnR%   R/   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   render_text9  s    c         C   s   y? t  j d |  j |  j j |  j |  j j |  j f  } WnK t k
 r t _	 t  j d |  j |  j |  j |  j f  j
 d  } n X| S(   NR   R5   i   (   i   i   i   (   R7   RG   t   scaleRI   Rw   R   Rx   Rr   t   pygamet   errorRH   (   RT   RI   R/   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   render_imageN  s    -#c         C   s   |  j  |  _ |  j d k rF |  j j |  j |  j  d d d d n: |  j d k r |  j j |  j |  j  d d d d n  d  S(	   NR   R   i    R@   R3   R   (   i    i    (   i    i    (   R   RI   R   R   R   R   R   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   W  s    N(   R   R   t   NoneR9   R   R   R   R   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s
   				t   Navec           B   s   e  Z d    Z d   Z d   Z d d  Z d   Z d   Z d   Z d d  Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d  Z RS(   c         C   s  t  j j |  |  d  |  _ | |  _ |  j   t |  |  j d  |  _	 |  j	 j
 t  j d d  7_
 t |  |  j d  |  _ |  j j
 t  j d d 
 7_
 t |  |  j d  |  _ |  j j
 t  j d d  7_
 t |  |  j d  |  _ |  j j
 t  j d 
d  7_
 |  j	 |  j |  j |  j f |  _ t |  _ d  |  _ |  j   t  j j d |  j  t  j j d |  j  t  j j d	 |  j  t  j j d
 |  j  t j j t d   |  _ t j j t d   |  _ t j j t d   |  _  d  S(   Ni    iBi   i   i   i   s   TimeMaster.wait.animation.ends   TimeMaster.wait2.animation.ends   TimeMaster.wait3.animation.ends   director.updates   sonidos/Jump.oggs   sonidos/Laser2.oggs   sonidos/Explosion.ogg(!   R7   t   ViewR9   R   Rs   R-   t   reset_wordsR   t   palabrast   nR?   R>   t   st   ot   et   direccionesRB   t   visiblet   elegidaRK   RL   RM   t   clear_and_looset   repetirt   repetir2RN   R   t   mixert   SoundR   t   win_sndt	   loose_sndt	   drown_snd(   RT   RU   R-   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9   b  s.    		
!		
c         C   s   |  j  j j |  _ d  S(   N(   RU   t   Tt   offsetR?   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRN     s    c         C   sB   |  j  |  j \ } } |  j d  k r> t d d d d |  n  d  S(   NiF   i9   i    s   en-gb(   R   R   Rs   R   R   (   RT   R   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    i    c         C   sK   |  j  |  j \ } } |  j d  k r> t d d d d |  n  d  |  _ d  S(   Nid   i%   i    s   en-gb(   R   R   Rs   R   R   (   RT   t   modifierR   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    c         C   sc  |  j    t d d  |  _ |  j |  j \ } } d } d } d } x t d d  D] } |  j | j |  j |   | |  j k r t j j	 d | | |  j
  t j j	 d | | |  j
  t j j	 d | | |  j
  qT t j j	 d | | |  j  t j j	 d | | |  j  t j j	 d | | |  j  qT Wt d d d d |  |  j   d  S(   Ni    i   t   upt   downt   rightt   leftt   keypad_8t   keypad_2t   keypad_6t   keypad_4t   keypad_9t   keypad_3t   keypad_1t   keypad_7i   s   input.keyboard.down.i2   i9   s   en-gb(   s   upR   s   rights   left(   R   R   R   R   (   R   R   R   R   (   R   R   R   R   R   R   R   R7   RL   RM   t   ganat   pierdeR   t   invade(   RT   R   R   t   teclast   teclas2t   teclas3t   index(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR^     s"    
!"c         C   sP   t  j j d |  j  |  j j j |  j  |  j   t  j j	 d |  j  d  S(   Ns   TimeMaster.wait.animation.end(
   R7   RL   RV   R   RU   R   t   stop_animationt
   delay_animt   clearRM   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt
   next_level  s    
c         C   sa   d } d } d } xH | | | g D]7 } y | j  t j j |   SWq" t k
 rX q" Xq" Wd  S(   NR   R   R   R   R   R   R   R   R   R   R   R   (   s   ups   downs   rights   left(   s   keypad_8s   keypad_2s   keypad_6s   keypad_4(   s   keypad_9s   keypad_3s   keypad_1s   keypad_7(   R   R   t   keyt   nameRr   (   RT   t   keycodeR   R   R   t   keyset(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt	   key_index  s    c         C   s   |  j  |  j \ } } | r; |  j  |  j |  \ } } n  | rR d | d } n d | d } |  j j j | d | } | |  j j _ |  j j j   d  S(   Nt   "s   " is corrects
   " is wrongt   red(   R   R   R   RU   t   labelt   set_trans_textRI   t   blink(   RT   t   ganamosR   R   R   t   fraseR/   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt
   set_answer  s    c         C   s   |  j  t | j  t |  j  t |  _ |  j   |  j j j	 |  j
  |  j j j	 |  j  d } |  j j | 7_ t j r t j j |  j j  n  d  S(   Ni(   R   RB   R   R   R   Rs   R   RU   R   R   t   delay2_animt   delay3_animt   puntosR	   t   gameviewt   update_score(   RT   RL   t   castigo(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    	
	c         C   s   |  j  t  t |  j  t |  _ |  j   |  j j j |  j	  |  j j j |  j
  d } |  j j | 7_ |  j j t d k r t |  j j _ |  j j   n  t j r t j j |  j j  n  d  S(   Ni   (   R   R   R   R   Rs   R   RU   R   R   R   R   R   R    t   campoRC   t
   finalfinalR	   R   R   (   RT   t
   recompensa(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    	
	c         C   s   t  |  j  |  _ d  S(   N(   R0   R-   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    c         C   s   t  j d t  j j d t j d  d d t  j d t  j j d d  d d	 @|  _ d
 |  j _ t	 d	  |  _
 d |  j
 _ t	 d  |  _ d |  j _ t	 d  |  _ d |  j _ d  S(   Nt   anglei    i   R_   i   R   g?g333333?i   t   invasiont   waiti   t   wait2i   t   wait3(   R7   Re   Rf   Rk   t   matht   piRi   t   invasion_animRR   RP   R   R   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRK     s    ++c         C   s   t  |  j j _ |  j |  j |  j |  j f } x | D] } | j |  j	  q4 Wt
 |  _ |  j j j   |  j j j |  j  |  j j j |  j  |  j j j |  j  |  j j j |  j  |  j j j   d  S(   N(   RB   RU   R   R   R   R   R   R   RY   R   R   R   Rv   R   R   R   R   R   t   round(   RT   R   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    	c         C   s   t  |  j  t |  j d |  j  } t |  _ t j j	 d |  j
  t j j	 d |  j  t j j	 d |  j  t j j	 d |  j  d  S(   Ns	   GAME OVERs   TimeMaster.wait.animation.ends   TimeMaster.wait2.animation.ends   TimeMaster.wait3.animation.end(   R   R   t   DialogoRU   t   questionRB   R   R7   RL   RV   R   R   R   R   (   RT   t   dialog(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    	c         C   s   |  j  j j   |  j   |  j  j j   |  j  j j d t  t j j	 d |  j
  t j j	 d |  j  t j j	 d |  j  t j j	 d |  j  d  S(   NRu   s   TimeMaster.wait.animation.ends   TimeMaster.wait2.animation.ends   TimeMaster.wait3.animation.end(   RU   R   t   killR   RW   Rv   RB   R7   RL   RV   R   R   R   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRW     s    
c         C   s   t  |  j d |  j  } d  S(   Ns   Play again?(   R   RU   t   reset_and_clear(   RT   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   )  s    c         C   sE   d |  j  _ t j r. t j j |  j  j  n  t |  _ |  j   d  S(   Ni    (   RU   R   R	   R   R   R   R   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   ,  s
    		c         C   s  |  j  j j   x6 |  j |  j |  j |  j f D] } | j |  j  q/ W|  j  j j |  j	  t
 |  _ |  j  j j |  j  |  j  j j d  d } d } d } |  j d  k	 rx t d d  D] } | |  j k r4t j j d | | |  j  t j j d | | |  j  t j j d | | |  j  q t j j d | | |  j  t j j d | | |  j  t j j d | | |  j  q Wn  d  S(   Ni   R   R   R   R   R   R   R   R   R   R   R   R   i    i   s   input.keyboard.down.(   s   ups   downs   rights   left(   s   keypad_8s   keypad_2s   keypad_6s   keypad_4(   s   keypad_9s   keypad_3s   keypad_1s   keypad_7(   RU   R   t
   stop_roundR   R   R   R   R   R   R   RB   R   R   Rt   Rs   R[   R   R   R   R7   RL   RV   R   R   (   RT   t   acertadaR   R   R   R   R   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   3  s&    %	!N(   R   R   R9   RN   R   R   R^   R   R   R   R   R   R   R   RK   R   R   RW   R   R   R   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   a  s$   	%		
											
		t
   TimeMasterc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   t  j j |  |  d |  _ t  j d d  |  _ d |  _ d |  _ t  j d t  j	 j
 d d  d d	 t  j d t  j	 j d d  d d |  _ d |  j _ t  j j d
 |  j  d  S(   NR4   R5   i   ii    R   i2   R_   i   s   TimeMaster.offset.animation.end(   i   i   (   ii(   i    i    (   i    i    (   i2   i    (   i    i    (   R7   R8   R9   RA   RG   RI   R?   R   Re   Rf   t   Arct   LinearTuplet   offset_animRR   RL   RM   t
   endhandler(   RT   RU   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9   M  s    			$+c         C   s   d |  _  d  S(   Nt   quieto(   RA   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR  ]  s    c         C   s/   |  j  d k s+ |  j |  j  d |  _  n  d  S(   Nt   rodando(   RA   RY   R  (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   `  s    c         C   s&   |  j  d k r" |  j |  j  n  d  S(   NR  (   RA   R   R  (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   e  s    (   R   R   R9   R  R   R   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   L  s   			R   c           B   s>   e  Z d e d   Z d   Z d   Z e d  Z d   Z RS(   c         C   s  t  j j |  |  | |  _ d |  _ t  j | j  d |  _ d |  _ d |  _	 t
 d  } | r t  j | d d  |  _ t  j | d d  |  _ |  j j |  _ |  j |  } | |  _ d |  _ nz t  j | d	 d  |  _ |  j j |  _ t  j d
 t
 d   |  _ |  j |  } |  j j | d |  j d d f d d | st  j j d |  j  t  j j d |  j  t  j j d |  j  n  d  S(   NR3   i   i   t   primers   ../fonts/DejaVuSans.ttfi   i   i    i   R   s   imagenes/Menu_2.pngR   R@   R   s   input.mouse.down.lefts   input.keyboard.down.returns   input.keyboard.down.space(   i   i   i   (   i   i    i    (   i    i    i    (   R7   R8   R9   t   callbackR@   R>   R5   R?   t   margenR<   R   R   R   t   font_redR   R   R   RI   R   RG   t   set_textR   RL   RM   t   go_callback(   RT   RU   t   textoR  t   transparentR   R/   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9   l  s0    					c         C   sf   t  j j d |  j  t  j j d |  j  t  j j d |  j  |  j rX |  j   n  |  j   d  S(   Ns   input.mouse.down.lefts   input.keyboard.down.returns   input.keyboard.down.space(   R7   RL   RV   R  R  R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s    	c         C   sh   t  j d d	  j d
  } t  j d t  j j | |  j g d d d d } t |  _ |  j	 |  d  S(   NR5   i   i    RI   t   timesi   R_   i   (   i   i   (   i    i    i    i    (
   R7   RG   RH   Re   Rf   t   IterateRI   R   R   RY   (   RT   t   blankt   anim(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    3	c         C   s1   | r |  j  j |  } n |  j j |  } | S(   N(   R
  R   R   (   RT   R   R   RI   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    c   	      C   s   | |  _  |  j j d  d } |  j d |  j | } t | |  j   } t |  |  j } t	 j
 d |  j | f  } d } xM | D]E } | j d |  j j |  d d | |  j f d d  | d	 } q Wd |  _ | S(
   NR   i    i   R5   RI   R   R@   R   i   (   t   _textR   R   Rw   R	  R   R   R   R   R7   RG   R   R   R   (	   RT   R   R   R   R   R   R   R   R%   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s    		N(	   R   R   R   RB   R9   R  R   R   R  (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR   j  s
   		t   Titlec           B   s   e  Z d    Z RS(   c         C   sW   t  j j |  |  t  j t d   |  _ d |  _ | j d d f |  _ d |  _	 d  S(   Ns   imagenes/juego3_titulo.pngR  i   id   R3   (
   R7   R8   R9   RG   R   RI   R<   Rw   R?   R@   (   RT   RU   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9     s
    	(   R   R   R9   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s   t   Shipc           B   s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C   s   t  j j |  |  t  j t d   |  _ d |  _ | j d | j d f |  _	 t  j
 | j  d |  _ d |  _ t j j t d   |  _ |  j   t  j j d |  j  t  j j d |  j  d  S(	   Ns   imagenes/Cruiser.pngR  i   id   R3   s   sonidos/Randomize4.oggs   Ship.goodbye.animation.ends   Ship.demora.animation.end(   R7   R8   R9   RG   R   RI   R<   Rw   Rx   R?   R>   R5   R3   R@   R   R   R   R   RK   RL   RM   t   thankst   burn(   RT   RU   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9     s    		
c         C   s   t  |  j  d  S(   N(   R   R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s    c         C   s   t  |  j d |  j  |  _ d  S(   Ns   You've won. Thanks for playing.(   R   RU   R  t   intro(   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s    c         C   s  t  j d t  j j |  j |  j  d  } t  j d t  j j d d  d  } t  j d t  j j d d  d  } |  j j	 d d	 f } t  j d t  j j |  j |  d  } | | | | @} d
 | _
 |  j j j   |  j |  t d  |  _ d |  j _
 |  j |  j  d  S(   NR?   i   t   scale_yi   g      ?t   scale_xg?i   iRb   i   R6   (   R7   Re   Rf   R  R?   R3   Rk   Ri   RU   Rw   RR   R   Rb   RY   RP   RQ   (   RT   Rq   t   bt   cRc   t   dt   composition(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRK     s    *$$'	(   R   R   R9   R  R  RK   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR    s   			R	   c           B   sS   e  Z e Z e Z e e e d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(   c         C   sD  t  j j |  t  t   t |   |  _ d d d g |  _ d |  _ t  j	 d d  } | |  _
 t |  |  |  _ t |   |  _ t |  d d t |  _ t |  j _ d |  j _ |  j   t  j j d	 t  j j d
 |  t j j j t d   t j j j d  | r| t  _! n  | r@t" j#   t  j j d |  j$  n  d  S(   NR2   R   R  i    R5   i  t   WORDR  s   system.quitRU   s   musica/ObservingTheStar.oggis   director.update(   i  i  (%   R7   t   SceneR9   t   SIZER+   R   R   t   layersR   RG   t
   backgroundR   R]   R1   R   R   R   R   RB   R   R<   t   intro0RL   RM   t   directorR"   R   R   t   musict   loadR   R   R	   R   t   gtkt   threads_initt   gtk_main_iteration(   RT   R-   t   fake_gtkR   t   img(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9     s*    		

c         C   s+   t  |  d |  j  |  _ t |   |  _ d  S(   Ns<   Now I must get to my ship. It is at the bottom of the ocean.(   R   t   intro1R  R  t   titulo(   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR$    s    c         C   s,   t  |  d |  j j  |  _ |  j j   d  S(   NsK   Listen carefully and use the arrow keys to navigate in the right direction.(   R   R   R[   R  R.  R   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR-    s    c         C   s    t  |   |  _ |  j j   d  S(   N(   R  t   shipR]   RW   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR     s    c         C   s<   | t  k r t j j j   n t j j j   | t _ d  S(   N(   R   R   R   R&  t   pauseR   R	   R
   (   RT   t   value(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   mute  s    c         C   s   t  j t  d  S(   N(   R(  t   main_iterationRB   (   RT   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR*  "  s    (   R   R   RB   R
   R   R#   R9   R$  R-  R   R2  R*  (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR	     s   '				RP   c           B   s#   e  Z d  Z d d  Z d   Z RS(   s   
    Animation which performs no actions. Useful for lining up appended
    and parallel animations so that things run at the right times.
    g      ?c         C   s.   t  |  _ t g   |  _ | |  _ t  |  _ d  S(   N(   RB   t   absolutet   sett
   propertiesR_   t   loop(   RT   R_   (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyR9   +  s    		c         C   s   i  S(   N(    (   RT   t   spritet   progress(    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   evaluate1  s    (   R   R   t   __doc__R9   R:  (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyRP   &  s   c           C   s   t  j j t d t   d  S(   NR+  (   R7   R%  t   pushR	   R   (    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   main4  s    t   __main__t
   fullscreen(   i  i  (   i@   i@   (4   t   sysR    R   t   timeR!   R   t   abspatht   dirnamet   __file__R   R   t   insertt   GlobalesR   R(  R   R   t   initR7   R   R   R   t   collectionsR!  t   TILER   R   R   R#   R   R    R*   R+   R0   R8   R1   R   R   R   R   R   R  R  R   R	   Re   RP   R=  R   R%  RB   t   run(    (    (    s>   /home/icarito/Proyectos/peru-learns-english/Games/ug3/runme.pyt   <module>   sT   						FH&C	