-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacter.py
More file actions
35 lines (25 loc) · 882 Bytes
/
character.py
File metadata and controls
35 lines (25 loc) · 882 Bytes
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
class Character:
def kill(self):
self.is_alive = False
def __init__(self, name, description, alive=True):
self.name = name
self.description = description
# alive = false -> character is dead
self.is_alive = alive
class Enemy(Character):
def __init__(self, name, description, level, object_list):
Character.__init__(self, name, description, True)
self.level = level
self.object_list = object_list
class Protagonist(Character):
def increase_level(self):
self.level += 1
def add_to_rucksack(self, obj):
self.rucksack.append(obj)
def __init__(self, name, description):
Character.__init__(self, name, description, True)
self.level = 1
self.location = None
self.rucksack = []
self.weaponInHand = None
self.shieldInHand = None