Problème avec pygame

TheTerminator_of_the_informatic - 13 oct. 2021 à 20:18
toniocraft Messages postés 1 Date d'inscription mercredi 20 octobre 2021 Statut Membre Dernière intervention 20 octobre 2021 - 20 oct. 2021 à 17:53
J'ai essayé de faire un moteur physic avec pygame mais un bug se produit. Quelqu'un peut m'aidez svp? voici les deux source:
import pygame
from coolGame import *

pygame.init()


pg = pygame
screen = pg.display.set_mode((660,660))

level = "Ressource\level.csv"
f = open(level,"r")
x = 0
y = 0

for line in f.readlines():
    data = line.split(",")
    for cell in data:
        if cell == "1":
            WATER(x ,y  ,screen)
        else:
            print(":(")
        x += 33
    y += 33


Running = True

while Running:
    pg.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
            pygame.quit()
et la deuxième ( le coolGame)
import pygame

pygame.init()

def collision(tailleX,tailleY,DX,DY, JoueurRect):
    Cimage = pygame.Rect(DX,DY,tailleX,tailleY)
    if Cimage.colliderect(JoueurRect):
        return true
    else:
        return false


class WATER:
    def __init__(self,x,y,screen):
        self.image = pygame.image.load("ressource\Water.jpg")
        self.rect = pygame.Rect(x,y,33,33)
        screen.blit(self.image,self.rect)
        

1 réponse

toniocraft Messages postés 1 Date d'inscription mercredi 20 octobre 2021 Statut Membre Dernière intervention 20 octobre 2021
20 oct. 2021 à 17:53
Salut, peux tu envoyer ton erreur stp ?
0
Rejoignez-nous