#!/usr/bin/env python
# -*-coding:utf8-*-
background_image_filename = 'j.jpg'
#sprite_image_filename= 'ojizousan3.png'
sprite_image_filename3= 'ojizousan2.png'
sprite_image_filename4 = 'ojizousan4.png'
sprite_image_filename5 = 'empty.png'
sprite_image_filename6 = 'ojizousanmarins.png'
sprite_image_filename7= 'afro.png'

a = 0
b = 0
c = 0
import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((640,480),0,32)

background = pygame.image.load(background_image_filename).convert()
sprite = pygame.image.load(sprite_image_filename3).convert_alpha()
sprite2 = pygame.image.load(sprite_image_filename4).convert_alpha()
sprite3 = pygame.image.load(sprite_image_filename5).convert_alpha()
sprite4 = pygame.image.load(sprite_image_filename6).convert_alpha()
sprite7 = pygame.image.load(sprite_image_filename7).convert_alpha()
sp = sprite7.set_colorkey((0,0,0))
#sprite5 = pygame.image.load(sprite_image_filename).convert_alpha()
#sprite6 = pygame.image.load(sprite_image_filename).convert_alpha()
clock = pygame.time.Clock()

x = 0.
i = 0.
l = 0
s = 0
speed = 51.
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            exit()
        if event.type == KEYDOWN:
            exit()
    screen.blit(background,(0,0))
    screen.blit(sprite,(s,150))
    screen.blit(sprite,(s-120,150))
    screen.blit(sprite,(s-220,150))
    screen.blit(sprite,(s-320,150))
    screen.blit(sprite,(s-420,150))
    screen.blit(sprite,(s-520,150))
    screen.blit(sprite7,(s-520,150))
    screen.blit(sp,(s-520,150))
    time_passed = clock.tick()
    time_passed_seconds = time_passed / 1000.0

    distance_moved = time_passed_seconds * speed
    s += distance_moved
    #screen.blit(sprite3,(s,150))
    #print str(x) + "x"
    print "time_passed" + str(time_passed )
    print distance_moved
    print str(s) + "s"
    print x
    #if s > 120:
    #   screen.blit(sprite2,(x-s,150))
        
    #x+= 1 
    
    if s > 1240.:
      s = 0.
    pygame.display.update()

        

    
