import pygame
pygame.init()
screen = pygame.display.set_mode((460, 230))
pygame.display.set_caption("lol")
icon = pygame.image.load('photo/i.webp')
pygame.display.set_icon(icon)
bg=pygame.image.load('photo/font.webp')
walk_left = [pygame.image.load('playerr/1.png'),
pygame.image.load('playerr/2.png'),
pygame.image.load('playerr/3.png'),
pygame.image.load('playerr/4.png'),
pygame.image.load('playerr/5.png'),
pygame.image.load('playerr/6.png'),
pygame.image.load('playerr/7.png'),
pygame.image.load('playerr/8.png'),
pygame.image.load('playerr/9.png'),
pygame.image.load('playerr/10.png'),
]
walk_right = [pygame.image.load('playerr/11.png'),
pygame.image.load('playerr/12.png'),
pygame.image.load('playerr/13.png'),
pygame.image.load('playerr/14.png'),
pygame.image.load('playerr/15.png'),
pygame.image.load('playerr/16.png'),
pygame.image.load('playerr/17.png'),
pygame.image.load('playerr/18.png'),
pygame.image.load('playerr/19.png'),
pygame.image.load('playerr/20.png'),
]
player_anim_count = 0
bg_x = 0
player_speed = 5
player_x = 100
player_y = 50
is_jump = False
jump_count = 7
bg_sound = pygame.mixer.Sound('music/mis.mp3')
running = True
while running:
screen.blit(bg,(bg_x,0))
screen.blit(bg,(bg_x + 460, 0))
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
screen.blit(walk_left[player_anim_count],(player_x,player_y))
else:
screen.blit(walk_right[player_anim_count],(player_x,player_y))
if keys[pygame.K_LEFT] and player_x > 50:
player_x -= player_speed
elif keys[pygame.K_RIGHT] and player_x < 200:
player_x += player_speed
if not is_jump:
if keys[pygame.K_SPACE]:
is_jump = True
else:
if jump_count >= -7:
if jump_count > 0:
player_y -= (jump_count ** 2) / 2
else:
player_y += (jump_count ** 2) / 2
jump_count -= 1
else:
is_jump = False
jump_count = 7
if player_anim_count == 9:
player_anim_count = 0
else:
player_anim_count += 1
bg_x -= 2
if bg_x == -460:
bg_x = 0
pygame.display.update()
for event in pygame.event.get():
if event.type==pygame.QUIT:
running=False
pygame.quit
pygame.init()
screen = pygame.display.set_mode((460, 230))
pygame.display.set_caption("lol")
icon = pygame.image.load('photo/i.webp')
pygame.display.set_icon(icon)
bg=pygame.image.load('photo/font.webp')
walk_left = [pygame.image.load('playerr/1.png'),
pygame.image.load('playerr/2.png'),
pygame.image.load('playerr/3.png'),
pygame.image.load('playerr/4.png'),
pygame.image.load('playerr/5.png'),
pygame.image.load('playerr/6.png'),
pygame.image.load('playerr/7.png'),
pygame.image.load('playerr/8.png'),
pygame.image.load('playerr/9.png'),
pygame.image.load('playerr/10.png'),
]
walk_right = [pygame.image.load('playerr/11.png'),
pygame.image.load('playerr/12.png'),
pygame.image.load('playerr/13.png'),
pygame.image.load('playerr/14.png'),
pygame.image.load('playerr/15.png'),
pygame.image.load('playerr/16.png'),
pygame.image.load('playerr/17.png'),
pygame.image.load('playerr/18.png'),
pygame.image.load('playerr/19.png'),
pygame.image.load('playerr/20.png'),
]
player_anim_count = 0
bg_x = 0
player_speed = 5
player_x = 100
player_y = 50
is_jump = False
jump_count = 7
bg_sound = pygame.mixer.Sound('music/mis.mp3')
running = True
while running:
screen.blit(bg,(bg_x,0))
screen.blit(bg,(bg_x + 460, 0))
keys = pygame.key.get_pressed()
if keys[pygame.K_LEFT]:
screen.blit(walk_left[player_anim_count],(player_x,player_y))
else:
screen.blit(walk_right[player_anim_count],(player_x,player_y))
if keys[pygame.K_LEFT] and player_x > 50:
player_x -= player_speed
elif keys[pygame.K_RIGHT] and player_x < 200:
player_x += player_speed
if not is_jump:
if keys[pygame.K_SPACE]:
is_jump = True
else:
if jump_count >= -7:
if jump_count > 0:
player_y -= (jump_count ** 2) / 2
else:
player_y += (jump_count ** 2) / 2
jump_count -= 1
else:
is_jump = False
jump_count = 7
if player_anim_count == 9:
player_anim_count = 0
else:
player_anim_count += 1
bg_x -= 2
if bg_x == -460:
bg_x = 0
pygame.display.update()
for event in pygame.event.get():
if event.type==pygame.QUIT:
running=False
pygame.quit