-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreference.py
108 lines (88 loc) · 3.18 KB
/
reference.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
from onboard import OnBoard
import pygame as pg
from player import Person
class ReferencePlatform(OnBoard):
"""
Defining all the reference images for the platforms.
Attributes:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the image.
"""
def __init__(self, raw_image, position):
"""
Initialize the image, position and rect instance attributes
Args:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the platform.
"""
# initializing the position and image
super().__init__(raw_image, position)
class ReferenceLadder(OnBoard):
"""
Defining all the reference images for the ladders.
Attributes:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the image.
"""
def __init__(self, raw_image, position):
"""
Initialize the image, position and rect instance attributes
Args:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the ladder.
"""
# initializing the position and image
super().__init__(raw_image, position)
class ReferenceEndcap(OnBoard):
"""
Defining all the reference images for the ends of the platforms.
Attributes:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the image.
"""
def __init__(self, raw_image, position):
"""
Initialize the image, position and rect instance attributes
Args:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the platform.
"""
# initializing the position and image
super().__init__(raw_image, position)
class ReferenceCat(Person):
"""
Defining the reference image for the cat.
Attributes:
raw_image: A string representing the path to a png.
position: A tuple representing the coordinates of
the image.
"""
def __init__(self, raw_image, position):
"""
Initiate a player that inherits from the Person class with a certain
movement speed.
Args:
raw_image: A string representing the path to a png.
position: A tuple of integers representing coordinates.
"""
# initializing the position and image
super().__init__(raw_image, position)
def update_position_cat(self, raw_image, position):
"""
Update the position of the reference image for the cat
Args:
position: A tuple representing the position of the cat
raw_image: A string representing the path to a png.
Return:
_position: The position of the reference image for the cat.
"""
self.image = raw_image
self._position = (position[0] - 2, position[1] + 10)
self.rect.center = self._position
return self._position