Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. class Personnage:
  2.     """Classe représentant un labyrinthe."""
  3.  
  4.     def __init__(self):
  5.         self.x = 0
  6.         self.y = 0
  7.         self.direction = "d"
  8.  
  9.  
  10.     def deplacer(self,direction):    # d = droit / g = gauche / b = bas / h = haut
  11.         self.direction = direction
  12.  
  13.         if (direction == "d" and self.x!=15 and (labyrinthe.structure[self.x+1][self.y] == "" or labyrinthe.structure[self.x+1][self.y]== "" )):  #Verifie si la case suivante n'est pas en dehors et que ce n'est pas un mur,
  14.             self.x +=1
  15.         if (direction == "g" and self.x!=0):
  16.             self.x -= 1
  17.         if (direction == "b" and self.y!=15):
  18.             self.y += 1
  19.         if (direction == "h" and self.y!=0):
  20.             self.y -= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement