-
Notifications
You must be signed in to change notification settings - Fork 0
/
persons.py
87 lines (77 loc) · 1.75 KB
/
persons.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
import math
from colorcode import color
class person:
def __init__(self,x,y):
self.__x=x
self.__y=y
self.__velx=0
self.__vely=0
self.dr=0
def printp(self,sh):
xp=math.floor(self.__x)
yp=math.floor(self.__y)
if sh:
print(color.CYAN+color.BOLD+"\033[{};{}f ( ^@ )".format(yp,xp))
print(color.RED+"\033[{};{}f ( \"| )".format(yp+1,xp)+color.END)
else:
print(color.CYAN+color.BOLD+"\033[{};{}f ^@".format(yp,xp))
print(color.RED+"\033[{};{}f \"|".format(yp+1,xp)+color.END)
def updatex(self):
self.__x+=self.__velx
self.__y+=self.dr
def update(self):
self.__x+=self.__velx
self.__vely+=0.05
self.__y+=self.__vely
if(self.__vely> 1.5):self.__vely=1.5
if(self.__vely<-1.2):self.__vely=-1.2
if(self.__y<=4):
self.__y=4
self.__velx=0
self.__vely=0
if(self.__y>=40):
self.__velx=0
self.__y=40
self.__vely=0
if(self.__x<1):
self.__x=1
self.__velx=1
self.__vely=0
if(self.__x>=140):
self.__x=140
self.__velx=0
self.__vely=0
def upy(self,ch):
self.__vely+=ch
def upx(self,ch):
self.__velx+=ch
def getx(self):
return self.__x
def gety(self):
return self.__y
class boss:
def __init__(self):
self.__y=20
def update(self,dir):
if dir:
self.__y += 0.1
else:
self.__y -= 0.1
if self.__y<5:
self.__y=5
if self.__y>35:
self.__y=35
def printb(self):
yp=math.floor(self.__y)
# print("\033[{};{}f ^@".format(yp,95))
# print("\033[{};{}f \"|".format(yp+1,95))
print(color.GREEN+color.BOLD+"""\033[{};7f
/\_/\ / (_
(0 0)// (_
(oo)/ -- _(
,__//\ \ _(
;-- \ _(
(( ) ) .*
z(____)...' """.format(yp)+color.END)
def gety(self):
return self.__y