Browse Source

new prgrm py pour les consatnts / Image

master
laneury.a 1 week ago
parent
commit
16062826bc
  1. 48
      classes.py

48
classes.py

@ -0,0 +1,48 @@
import pygame
from pygame.locals import *
class Image():
def __init__ (self, fenetre, chm_acces, pos_x, pos_y):
self.fenetre = fenetre
self.chm_acces = chm_acces
self.pos_x = pos_x
self.pos_y = pos_y
self.image = pygame.image.load(self.chm_acces).convert_alpha()
self.fenetre.blit(self.image, (self.pos_x, self.pos_y))
def translater (self,axe, sens, vitesse):
self.axe = axe
self.sens = sens
self.vitesse = vitesse
if self.axe == "x":
if sens == "gauche":
self.pos_x = self.pos_x - self.vitesse
else:
self.pos_x = self.pos_x + self.vitesse
else:
if sens == "haut":
self.pos_y = self.pos_y - self.vitesse
else:
self.pos_y = self.pos_y + self.vitesse
self.fenetre.blit(self.image, (self.pos_x, self.pos_y))
def maj(self):
self.fenetre.blit(self.image, (self.pos_x,self.pos_y))
def verifier(self):
pass
"""
class Groupeimage():
def __init__ (self, fenetre,):
def maj(self):
"""
Loading…
Cancel
Save