Make image to use it like character in pygame
<p>I'm beginner with using pygame but i saw a website that provide a tutorial and he used character in the program </p>

<p>here it is <a href="http://i.stack.imgur.com/lKN08.png" rel="nofollow"><img src="http://i.stack.imgur.com/lKN08.png" alt="enter image description here"></a> </p>

<p>so my question is can i make a character like this or not and if yes is there is any websites that can me make something like this </p>

<p>Your question is vague: Do you want to MAKE a character or make an image BEHAVE like a character?</p>

<p><strong>If you wanted to make a character</strong><br>
If you wanted to make a character, I suggest going to <a href="http://pixelartor.com/" rel="nofollow">PixelArtor</a> and choosing the file size you want. I recommend 64 by 64 or 128 by 128, because if you choose 32 by 32 or below, it might be too small. If you are on a Unix system, there might already be an installation package for <a href="http://gimp.org" rel="nofollow">GIMP</a> on there, so go to downloads page and read the instructions on how you install it. If there isn't you can download it on the downloads page. (I'm running Windows, so I wouldn't know for sure)</p>

<p>You can then display the image on your PyGame screen like so:</p>

<pre><code>import pygame
from pygame.locals import *
display = pygame.display.set_mode((1024,1024)) # window size is determined here
pygame.init()
character = pygame.image.load("your/path/to/character.png")
display.blit(character,(0,0)) # These are the X and Y coordinates
pygame.display.update()
</code></pre>

<p>But of course, that creates a still image that will not move no matter what keys you press.</p>

<p><strong>If you want a loaded image to behave like a character</strong></p>

<pre><code>import pygame
from pygame.locals import *
display = pygame.display.set_mode((1024,1024)) # window size is determined here
pygame.init()
character = pygame.image.load("your/path/to/character.png")
background = pygame.image.load("your/path/to/background.png")
characterx = 0
charactery = 0
while True:
    display.blit(background,(0,0))
    display.blit(character,(characterx,charactery))
    for event in pygame.event.get():
        if event.type == KEYDOWN:
            if event.key == K_a:
                characterx -= 2
            if event.key == K_d:
                characterx += 2
            if event.key == K_w:
                charactery -= 2
            if event.key == K_s:
                charactery += 2
        if event.type == QUIT:
            pygame.quit()
            exit()
    pygame.display.update()
</code></pre>

<p>Okay, so in this code, the objects in play are:
characterx and charactery store the X and Y positions of the loaded image character. These change when keys are pressed, changing where the character is displayed, simulating movement.
The event loop is the line that starts 
<code>for event in pygame.event.get():</code>
This loop handles events like mouse movement, clicking, keyboard detection, and quitting.
The background is so that the extra trails left by the character don't show up.
Try removing the line 
<code>display.blit(background,(0,0))</code>
and you will see that the character "trail" is left behind.</p>

python python-2.7 pygame