def war_col(warg):
for barrier in warg:
if y + l >= warg.y:
if warg.x <= x <= warg.x + warg.w :
return False
elif warg.x <= x + w <= warg.x + warg.w:
return False
return True
if keys[pygame.K_w]:
pygame.display.flip()
else:
pygame.display.update()
pygame.init()
war_arr= []
w0r_war_arr(war_arr)
game_over = False
paused = False
while not game_over:
clock.tick(30)
keys = pygame.key.get_pressed()
for event in pygame.event.get():
if event.type == pygame.QUIT:
game_over = True
elif keys[pygame.K_w]:
paused = True
if keys[pygame.K_LEFT] and x > 5:
x -= spe
left = True
right = False
elif keys[pygame.K_RIGHT] and x < 500 - w - 5:
x += spe
left = False
right = True
else:
left = False
right = False
anim = 0
if not(jup):
if keys[pygame.K_UP] and y > 5:
y -= spe
if keys[pygame.K_DOWN] and y < 500 - l - 5 :
y += spe
if keys[pygame.K_SPACE] :
jup = True
else :
if jsp >= -10:
if jsp < 0:
y += (jsp ** 2) / 2
else:
y -= (jsp ** 2) / 2
jsp -= 1
else:
jup = False
jsp = 10