|
|
@ -16,20 +16,20 @@ X1_CADEAU1 = 14 |
|
|
|
Y1_CADEAU1 = 110 |
|
|
|
Y1_CADEAU1 = 110 |
|
|
|
X2_CADEAU1 = 22 |
|
|
|
X2_CADEAU1 = 22 |
|
|
|
Y2_CADEAU1 = 115 |
|
|
|
Y2_CADEAU1 = 115 |
|
|
|
POSITION_PLATEFORME = [[1,0,0,0,0,1],[1,1,1,0,1,0]] |
|
|
|
POSITION_PLATEFORME = [[1,0,0,0,0,1],[1,1,1,0,1,0],[1,1,1,0,1,0]] |
|
|
|
#Déclaration des classes |
|
|
|
#Déclaration des classes |
|
|
|
class Plateforme: |
|
|
|
class Plateforme: |
|
|
|
def __init__(self) -> None: |
|
|
|
def __init__(self) -> None: |
|
|
|
self.x = 10 |
|
|
|
self.x = 5 |
|
|
|
self.y = 10 |
|
|
|
self.y = 5 |
|
|
|
|
|
|
|
|
|
|
|
def afficher(self) -> None: |
|
|
|
def afficher(self) -> None: |
|
|
|
for colonne in range(1): |
|
|
|
for colonne in range(1): |
|
|
|
for ligne in range (6): |
|
|
|
for ligne in range (6): |
|
|
|
if POSITION_PLATEFORME[colonne][ligne] == 1: |
|
|
|
if POSITION_PLATEFORME[colonne][ligne] == 1: |
|
|
|
self.x = (self.x*(colonne+1)) |
|
|
|
x = (self.x*(colonne+1)) |
|
|
|
self.y = (self.y*(ligne+1)) |
|
|
|
y = (self.y*(ligne+1)) |
|
|
|
pyxel.blt(self.x,self.y,0,27,30,37,32) |
|
|
|
pyxel.blt(x,y,0,26,28,9,3) |
|
|
|
|
|
|
|
|
|
|
|
class Objet: |
|
|
|
class Objet: |
|
|
|
def __init__(self,x,y,x1,y1,x2,y2) -> None: |
|
|
|
def __init__(self,x,y,x1,y1,x2,y2) -> None: |
|
|
@ -111,7 +111,7 @@ class Monstre: |
|
|
|
self.x = 100 # coordonnée x du coin haut à gauche du carré |
|
|
|
self.x = 100 # coordonnée x du coin haut à gauche du carré |
|
|
|
self.y = 0 # coordonnée y du coin haut à gauche du carré |
|
|
|
self.y = 0 # coordonnée y du coin haut à gauche du carré |
|
|
|
|
|
|
|
|
|
|
|
def conditions_mouvements(self): |
|
|
|
"""def conditions_mouvements(self): |
|
|
|
flag = 0 |
|
|
|
flag = 0 |
|
|
|
while flag == 0: |
|
|
|
while flag == 0: |
|
|
|
if self.x == 0: |
|
|
|
if self.x == 0: |
|
|
@ -120,10 +120,7 @@ class Monstre: |
|
|
|
while flag == 1: |
|
|
|
while flag == 1: |
|
|
|
if self.x == 50: |
|
|
|
if self.x == 50: |
|
|
|
flag = 0 |
|
|
|
flag = 0 |
|
|
|
self.set_x(1) |
|
|
|
self.set_x(1)""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_x(self:'Monstre', dx:int) -> None: |
|
|
|
def set_x(self:'Monstre', dx:int) -> None: |
|
|
|
"""Déplace le zombie à gauche si dx positif, à droite si négatif""" |
|
|
|
"""Déplace le zombie à gauche si dx positif, à droite si négatif""" |
|
|
@ -197,7 +194,8 @@ class Jeu: |
|
|
|
pyxel.cls(4) |
|
|
|
pyxel.cls(4) |
|
|
|
self.perenoel.afficher() |
|
|
|
self.perenoel.afficher() |
|
|
|
self.monstre.afficher() |
|
|
|
self.monstre.afficher() |
|
|
|
self.monstre.conditions_mouvements() |
|
|
|
self.plateforme.afficher() |
|
|
|
|
|
|
|
#self.monstre.conditions_mouvements() |
|
|
|
self.objet.afficher() |
|
|
|
self.objet.afficher() |
|
|
|
self.objet2.afficher() |
|
|
|
self.objet2.afficher() |
|
|
|
|
|
|
|
|
|
|
|