-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcase_entity.py
72 lines (47 loc) · 1.47 KB
/
case_entity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""Les élements du labytinth."""
import pygame
import pygame_extend as p_e
import constants as cst
class CaseEntityGroup:
"""Classe qui stock les entités de labyrinthe."""
def __init__(self):
"""Initialisation."""
self.group = pygame.sprite.Group()
class LabyrinthObject():
"""CLasse mère aux objets du labyrinth."""
def __init__(self, filename, x, y, door=False):
"""On définit les propriétés de base."""
self.solid = False
self.x = x
self.y = y
if not door:
self.apparent = p_e.SimpleSprite(
filename, self.x * cst.IMG_SIZE, self.y * cst.IMG_SIZE)
else:
self.apparent = p_e.AnimatedSprite(
(x, y), (60, 60), 'img/door-anim', frame=1)
class Wall(LabyrinthObject):
"""Définition des murs du labyrinthe."""
def __init__(self, filename, x, y):
"""Initialisation de l'objet."""
super(Wall, self).__init__(filename, x, y)
self.solid = True
self.name = "wall"
class Path(LabyrinthObject):
"""Définition des chemins."""
def __init__(self, filename, x, y, hero=False):
"""Init."""
super(Path, self).__init__(filename, x, y)
self.name = "path"
class Entrance(LabyrinthObject):
"""Définition de l'entrée du labyrinthe."""
def __init__(self, filename, x, y):
"""Init."""
super(Entrance, self).__init__(filename, x, y)
self.name = "exit"
class Door(LabyrinthObject):
"""Définition des portes."""
def __init__(self, filename, x, y):
"""Init."""
super(Door, self).__init__(filename, x, y, door=True)
self.name = "door"