fix
This commit is contained in:
16
script/ui.py
16
script/ui.py
@@ -8,17 +8,17 @@ class Point:
|
||||
|
||||
# 按纽
|
||||
class Button:
|
||||
def __init__(self, x, y, w = 0, h = 0):
|
||||
self.x = x
|
||||
self.y = y
|
||||
self.w = w
|
||||
self.h = h
|
||||
def __init__(self, x1, y1, x2 = 0, y2 = 0):
|
||||
self.x1 = x1
|
||||
self.y1 = y1
|
||||
self.x2 = x2
|
||||
self.y2 = y2
|
||||
|
||||
def get_point(self, ran = True):
|
||||
if ran == True and self.w > 0 and self.h > 0:
|
||||
return Point(self.x + int(random.uniform(self.w * 4, self.w * 0.7)), self.y + int(random.uniform(self.h * 0.4, self.h * 0.7)))
|
||||
if ran == True and self.x2 > 0 and self.y2 > 0:
|
||||
return Point(int(random.uniform(self.x1, self.x2)), int(random.uniform(self.y1, self.y2)))
|
||||
else:
|
||||
return Point(self.x, self.y)
|
||||
return Point(self.x1, self.y1)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user