o
    OZŽh  ã                   @   sx   d Z ddlZddlZej ej e¡¡d ZdZ	dZ
dZdZG dd„ dƒZd	d
„ Zdd„ Zedkr:eƒ  e ¡  dS dS )a‹   pygame.examples.moveit

This is the full and final example from the Pygame Tutorial,
"How Do I Make It Move". It creates 10 objects and animates
them on the screen.

It also has a separate player character that can be controlled with arrow keys.

Note it's a bit scant on error checking, but it's easy to read. :]
Fortunately, this is python, and we needn't wrestle with a pile of
error codes.
é    Ni€  ià  éP   é<   c                   @   s   e Zd Zdd„ Zddd„ZdS )Ú
GameObjectc                 C   s"   || _ || _| ¡  d|¡| _d S ©Nr   )ÚspeedÚimageZget_rectÚmoveÚpos)Úselfr   Úheightr   © r   úE/var/www/auris/lib/python3.10/site-packages/pygame/examples/moveit.pyÚ__init__   s   zGameObject.__init__Fc                 C   s¸   |r| j  j| j7  _|r| j  j| j8  _|r!| j  j| j7  _|r,| j  j| j8  _| j jtkr6d| j _| j jtt krBd| j _| j jtk rLt| j _| j jdk rZtt | j _d S d S r   )	r	   Úrightr   ÚtopÚWIDTHÚleftÚHEIGHTÚSPRITE_HEIGHTÚSPRITE_WIDTH)r
   ÚupÚdownr   r   r   r   r   r   #   s"   ÿzGameObject.moveN)FFFF)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r      s    r   c                 C   s    t j td| ¡}tj |¡ ¡ S )NÚdata)ÚosÚpathÚjoinÚmain_dirÚpgr   ÚloadÚconvert)Únamer   r   r   r   Ú
load_image9   s   r$   c                  C   s¨  t  ¡  t j ¡ } t j ttf¡}tdƒ}tdƒ}tdƒ}t j	 
|¡}t j	 
|¡}| |d¡ g }t|ddƒ}tdƒD ]}t||d |ƒ}| |¡ q;t j d¡ 	 t j ¡ }	|	t j rb|jd	d
 |	t j rm|jd	d |	t j rx|jd	d |	t j rƒ|jd	d | |d¡ t j ¡ D ]}
|
jt jkr™ d S qŽ|D ]}| ||j|j¡ qœ|D ]}|jd	d | |j|j¡ qª| |j|j¡ |  d¡ t j ¡  t j d¡ qR)Nzplayer1.gifz
alien1.gifz
liquid.bmp)r   r   é
   é   é(   zMove It!T)r   )r   )r   )r   r   éd   ) r    ÚinitÚtimeZClockÚdisplayÚset_moder   r   r$   Z	transformZscale2xZblitr   ÚrangeÚappendZset_captionÚkeyZget_pressedZK_UPr   ZK_DOWNZK_LEFTZK_RIGHTÚeventÚgetÚtypeZQUITr	   r   ZtickÚupdateÚdelay)ÚclockÚscreenZplayerÚentityÚ
backgroundÚobjectsÚpÚxÚoÚkeysÚer   r   r   Úmain?   sP   





ÿ

ær?   Ú__main__)Ú__doc__r   Zpygamer    r   ÚsplitÚabspathÚ__file__r   r   r   r   r   r   r$   r?   r   Úquitr   r   r   r   Ú<module>   s   6þ