{"id":162868,"student_id":2589,"content":"import game\nimport time\nimport random\n\nbuttom = game.create_sprite(\"start.png\", \"stop.png\")\nbuttom.x = 600\nbuttom.y = 450\ngame_start = False\nt = 0\nt_s = 0\nyour_ans = -1\n\ntarget = random.randint(10, 30)\n\ndef loop():\n global game_start, t, t_s, target, your_ans\n \n # 顯示目標時間\n game.draw_text(\"Target: \"+str(target)+\" s\", 380, 200, \"black\", 90)\n \n # 按下enter遊戲開始\n if key.enter and game_start == False:\n buttom.costume_id = 1\n t_s = time.time()\n game_start = True\n \n # 遊戲開始後,計時並畫面顯示時間\n if game_start == True:\n t = time.time() - t_s\n t = round(t, 2)\n # 超過7秒後隱藏時間\n if t \u003c= 7:\n game.draw_text(str(t)+\" s\", 500, 600, \"black\", 90)\n else:\n game.draw_text(\"??.?? s\", 480, 600, \"black\", 90)\n \n # 按下space停止計時\n if key.space and game_start == True:\n game_start = False\n your_ans = t\n \n # 顯示結果\n if your_ans \u003e -1:\n game.draw_text(\"Time: \"+str(your_ans)+\" s\" , 380, 600, \"black\", 90)\n \ngame.forever(loop)","created_at":"2020-07-06T02:12:02.704+08:00","updated_at":"2020-07-12T17:57:12.529+08:00","name":"人體計時器_T ","language":"python","screenshot":{"url":null},"parent_id":160773,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":116,"hashid":"5j3syprd","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2832782,"file_name":"stop.png","project_id":162868,"asset_id":233823,"created_at":"2020-07-06T02:12:02.710+08:00","updated_at":"2020-07-06T02:12:02.710+08:00"},{"id":2832783,"file_name":"start.png","project_id":162868,"asset_id":233822,"created_at":"2020-07-06T02:12:02.711+08:00","updated_at":"2020-07-06T02:12:02.711+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦