rendered paste body# -*- coding: utf-8 -*-import pygame #import de pygamefrom pygame import *#2eme import -> ca doit marcher sans ... bah dans le doute ...import sys, osimport threadingimport randomimport time #import de timepygame.init() #init de pygame class Moteur: """cette classe gère les fonctions vitales concernant l'affichage ...""" def __init__(self): self.size = width, height = 640, 480 #taille de l'écran self.screen = pygame.display.set_mode(self.size) #création de la fenêtre graphique pygame.display.set_caption('Civilis')#titre pour la fenêtre pygame.key.set_repeat(100, 200)#on active le "set repeat" return def generation(self,casesx,casesy): self.listcases = [] listbackground = ['herbe','desert','glace'] x=0 y=0 self.b = True while x < casesx*50: while y < casesy*50: case = Cases(x,y,listbackground[random.randint(0,2)],None) self.listcases.append(case) y+=50 if self.b == True: y=25 self.b = False else: y=0 self.b = True x+=40 return def affichage(self): global xmap global ymap black = 0, 0, 0 self.screen.fill(black) for cas in self.listcases: ob = pygame.image.load(os.path.join("decors",cas.background+".png")).convert_alpha() self.screen.blit(ob,(cas.x+xmap,cas.y+ymap)) pygame.display.update() return class Cases: def __init__(self,x,y,background,element): self.x = x self.y = y self.background = background self.element = element return def changeback(self,newback): self.background = newback return def changeelement(self,newelement): self.element = newelement return def evenement(): """ici, on gere les entrées de l'utilisateur !""" global xmap global ymap continu = True while continu == True: xmouse, ymouse = pygame.mouse.get_rel() if xmouse <= 5: xmap -= 1 if xmouse >=635: xmap += 1 if ymouse <= 5: ymap -=1 if ymouse >=475: ymap +=1 a.affichage()xmap = 0ymap = 0a = Moteur()a.generation(10,10)a.affichage()evenement()