Skip to content

Commit 8fabdb0

Browse files
committed
Update classes.py
1 parent 4e47bb3 commit 8fabdb0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

ellens-alien-game/classes.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,58 @@ class Alien:
2525
total_aliens_created: int = 0
2626

2727
def __init__(self, x_coordinate: int, y_coordinate: int):
28+
"""
29+
Initialize a new Alien at the provided coordinates.
30+
31+
Sets health to 3, assigns x and y coordinates, and increments
32+
Alien.total_aliens_created.
33+
34+
:param x_coordinate: Position on the x-axis.
35+
:param y_coordinate: Position on the y-axis.
36+
:return: None
37+
"""
2838
self.health: int = 3
2939
self.x_coordinate = x_coordinate
3040
self.y_coordinate = y_coordinate
3141
Alien.total_aliens_created += 1
3242

3343
def is_alive(self):
44+
"""
45+
Return whether the alien is alive.
46+
47+
:return: True if health > 0, else False.
48+
"""
3449
return self.health > 0
3550

3651
def hit(self):
52+
"""
53+
Decrement the alien's health by one point.
54+
55+
:return: None
56+
"""
3757
self.health -= 1
3858

3959
def teleport(self, new_x_coordinate, new_y_coordinate):
60+
"""
61+
Decrement the alien's health by one point.
62+
63+
:return: None
64+
"""
4065
self.x_coordinate = new_x_coordinate
4166
self.y_coordinate = new_y_coordinate
4267

4368
def collision_detection(self, other):
69+
"""
70+
Determine whether this Alien collides with another.
71+
72+
Implementation TBD; currently returns None.
73+
74+
:param other: Another Alien or object to check for
75+
positional overlap.
76+
:return: None
77+
78+
`Source: /ellens-alien-game/classes_test.py`
79+
"""
4480
pass
4581

4682

0 commit comments

Comments
 (0)