-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop.py
More file actions
30 lines (25 loc) · 901 Bytes
/
Copy pathoop.py
File metadata and controls
30 lines (25 loc) · 901 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
# -*- coding: utf-8 -*-
# Define the Class
class Character(object):
'''
Define the Character class object to make a game character.
Character class has a name, health, damage, inventory
'''
def __init__(self, name, health, damage, inventory):
self.name = name
self.health = health
self.damage = damage
self.inventory = inventory
def __repr__(self):
return self.name
# Create an object(instance) of Character class.
heroes = []
heroes.append(Character('아이어맨', 100, 200, {'gold': 500, 'weapon': '레이저'}))
heroes.append(Character('데드폴', 300, 50, {'gold': 300, 'weapon': '장검'}))
heroes.append(Character('울버린', 200, 100, {'gold': 200, 'weapon': '클로'}))
monsters = []
monsters.append(Character('고블린', 90, 30, {'gold': 50, 'weapon': '창'}))
print(heroes)
print(monsters)
del heroes[0]
print(heroes)