0

Hello i have some error that i can't resolve and i need your help please because i need to finish this in 1 week So first my program is a game 'Taupe' and i have some problem but i will tell you my most important problem, i have do a list for the apparition of my mole and another list for the apparition of the mole in precisely coordinate, mole appear but he don't disappear and that's my problem That's my code

    import pygame
import random
import time

pygame.init()

display_width = 600
display_height = 480

gameDisplay = pygame.display.set_mode((display_width, display_height))
fond = pygame.image.load("background.jpg").convert()
gameDisplay.blit(fond, (0, 0))
pygame.display.set_caption('Tape Taupe')
clock = pygame.time.Clock()

gameIcon = pygame.image.load('Taupe.png').convert_alpha()
pygame.display.set_icon(gameIcon)
Taupe1 = pygame.image.load("Taupe.png")
Taupe2 = pygame.image.load("Taupe.png")
Taupe3 = pygame.image.load("Taupe.png")
Taupe4 = pygame.image.load("Taupe.png")
Taupe5 = pygame.image.load("Taupe.png")
Taupe6 = pygame.image.load("Taupe.png")
Taupe7 = pygame.image.load("Taupe.png")
Taupe8 = pygame.image.load("Taupe.png")
Taupe9 = pygame.image.load("Taupe.png")

pygame.display.update()
Marteau = pygame.image.load('Marteau.png')


def Marteau(x, y):
    gameDisplay.blit(Marteau, (x, y))


perso1 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso1, (160, 55))

perso2 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso2, (320, 55))

perso3 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso3, (480, 55))

perso4 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (160, 200))

perso5 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (320, 200))

perso6 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (480, 200))

perso7 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (160, 350))

perso8 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (320, 350))

perso9 = pygame.image.load("troutaup.png").convert_alpha()
gameDisplay.blit(perso4, (480, 350))


def game_loop():
    x = (display_width * 0.45)
    y = (display_height * 0.8)

    x_change = 0
    y_change = 0

    gameExit = False

    while not gameExit:
        Taupe = random.choice([Taupe1, Taupe2, Taupe3, Taupe4, Taupe5, Taupe6, Taupe7, Taupe8, Taupe9])
    coordinates = random.choice(
        [[160, 55], [320, 55], [480, 55], [160, 200], [320, 200], [480, 200], [160, 350], [320, 350], [480, 350]])
    gameDisplay.blit(Taupe, coordinates)
    time.sleep(10)
    gameDisplay.blit(Taupe, coordinates)

    pygame.display.update()
    clock.tick(60)

    x += x_change
    y += y_change

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()


pygame.quit()
Christo
  • 1
  • 3
  • Which part of your code is *supposed* to make the sprite disappear? – 0x5453 May 11 '18 at 12:50
  • Taupe = random.choice([Taupe1, Taupe2, Taupe3, Taupe4, Taupe5, Taupe6, Taupe7, Taupe8, Taupe9]) coordinates = random.choice( [[160, 55], [320, 55], [480, 55], [160, 200], [320, 200], [480, 200], [160, 350], [320, 350], [480, 350]]) gameDisplay.blit(Taupe, coordinates) time.sleep(10) gameDisplay.blit(Taupe, coordinates) – Christo May 11 '18 at 12:51
  • Your second call to `blit` won't do anything because `coordinates` are the same both before and after the call to `sleep`. – 0x5453 May 11 '18 at 12:55
  • but i want that my 'Taupe' disapear and reapear in another coordinate – Christo May 11 '18 at 13:02
  • another question i have this issue libpng warning: Interlace handling should be turned on when using png_read_image how can i fix that ? – Christo May 11 '18 at 13:11
  • What OS are you using exactly? – Mercury Platinum May 11 '18 at 14:03
  • i use Windows, i've fix that but now muy problem my mole appear but did'nt disapear and appear in another hole, how can i do that ? – Christo May 12 '18 at 12:16

0 Answers0