用户:
小轩仔哟查看:0 回复:2 评论:0 创建时间:2020-05-04T18:40:08
【作品展示】

【作品介绍】
做着玩的,正在准备传说之下
【作品源代码】
from arcade import *
SCREEN_WIDTH = 300
SCREEN_HEIGHT = 200
SCREEN_TITLE = "cps"
class Cps(arcade.Window):
def __init__(self, width, height, title):
super().__init__(width, height, title)
self.setup()
def setup(self):
self.cps = 0
self.max_cps = 0
self.time = 0
self.click = 0
def on_draw(self):
start_render()
set_background_color(color.WHITE)
draw_text("cps:{} max:{}".format(self.cps, self.max_cps),150, 100, color.BLACK, 25, anchor_x="center", anchor_y="center")
def on_update(self,delta_time):
self.time += delta_time
if self.time >= 1:
self.cps = self.click
self.click = 0
self.time = 0
if self.cps > self.max_cps:
self.max_cps = self.cps
def on_mouse_press(self,x,y,button,modifiers):
if button:
self.click += 1
if __name__ == "__main__":
game = Cps(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
run()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn