Files
earn_gold/script/ui.py
2024-12-29 18:31:52 +08:00

25 lines
554 B
Python

import random
# 位置
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
# 按纽
class Button:
def __init__(self, x, y, w = 0, h = 0):
self.x = x
self.y = y
self.w = w
self.h = h
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)))
else:
return Point(self.x, self.y)