-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
62 lines (49 loc) · 1.45 KB
/
example.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
def mes(message):
print(message)
Entytes = dict()
Blocks = list()
class Player():
def __init__(self):
mes("Enter name (if you will play this body type iam) :")
self.name = input()
self.health = 100
self.experience = 2
self.strength = 5.2
self.armor = 20.3
self.x = 0
self.y = 0
Entytes[self.name] = self
del(self)
def move(self, x, y, yn, xn):
# yn - change y coordinate
# xn - change x coordinate
self.x = self.x + xn
self.y = self.y + yn
def attack(self, damage, target):
if target.x == self.x + 1 or self.x - 1 and target.y == self.y + 1 or self.y - 1:
selfdamage = damage//10
damage = damage - target.armor
target.health = target.health - damage
self.health = self.health - selfdamage
else:
mes("Target is not near")
def build(self, amount):
pass
def regen(self):
self.health = self.health + 1\
def checklive(self):
if self.health > 0:
pass
else:
mes("You die")
self.kill
return(False)
def kill(self):
Entytes.pop(self.name)
if self == Entytes.iam:
mes("You lose. Restarting...")
else:
pass
def initPlayer():
iam = Player()
mes("Creating your player ...")