{"id":208589,"student_id":10,"content":"from game import *\nimport random\n\ngame.set_backdrop(\"bg.png\") #設定背景\n\nbg = create_sprite('building.png') #建築物\nt1 = create_sprite('1.png', '2.png', '3.png') #人物1\nt2 = create_sprite('1.png', '2.png', '3.png') #人物2\nt3 = create_sprite('1.png', '2.png', '3.png') #人物3\nshadow = create_sprite('shadow.png')\n# shadow.hidden = True\n\nclock = 0 #紀錄遊戲迴圈次數\nkill = 0 #擊殺次數\nmiss = 0 #誤殺次數\n\ncreate_sound('bgm.mp3')\n\n#遊戲主迴圈\ndef loop():\n global clock, kill, miss\n clock += 1\n \n if clock % 120 == 0:\n t1.costume_id = random.randrange(2)\n t1.x = random.randrange(6) * 200 + 100\n t1.y = random.randrange(4) * 200 + 165\n \n if clock % 120 == 40:\n t2.costume_id = random.randrange(2)\n t2.x = random.randrange(6) * 200 + 100\n t2.y = random.randrange(4) * 200 + 165\n \n \n if clock % 120 == 80:\n t3.costume_id = random.randrange(2)\n t3.x = random.randrange(6) * 200 + 100\n t3.y = random.randrange(4) * 200 + 165\n \n if cursor.is_down and t1.touched(cursor) and t1.costume_id != 2:\n if t1.costume_id == 1: kill += 1\n else: miss += 1\n t1.costume_id = 2\n create_sound('shot.mp3')\n \n if cursor.is_down and t2.touched(cursor) and t2.costume_id != 2:\n if t2.costume_id == 1: kill += 1\n else: miss += 1\n t2.costume_id = 2\n create_sound('shot.mp3')\n \n if cursor.is_down and t3.touched(cursor) and t3.costume_id != 2:\n if t3.costume_id == 1: kill += 1\n else: miss += 1\n t3.costume_id = 2\n create_sound('shot.mp3')\n \n if clock == 600:\n draw_text('擊殺: ' + str(kill), 10, 10, 'black', 40)\n draw_text('誤殺: ' + str(miss), 10, 60, 'black', 40)\n shadow.hidden = True\n stop()\n \n shadow.x = cursor.x\n shadow.y = cursor.y\n\nforever(loop) #重複不斷執行","created_at":"2020-12-01T18:50:16.253+08:00","updated_at":"2020-12-10T21:54:58.072+08:00","name":"狙擊之王(完整版)","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/208589/37a93ece1fee0eb187e9c5a00b609605.jpg"},"parent_id":202852,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":201,"hashid":"2pds99qdn","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3636355,"file_name":"building.png","project_id":208589,"asset_id":289360,"created_at":"2020-12-02T11:08:59.776+08:00","updated_at":"2020-12-02T11:08:59.776+08:00"},{"id":3633707,"file_name":"3.png","project_id":208589,"asset_id":288126,"created_at":"2020-12-01T18:55:23.266+08:00","updated_at":"2020-12-01T18:55:23.266+08:00"},{"id":3633708,"file_name":"bg.png","project_id":208589,"asset_id":288127,"created_at":"2020-12-01T18:55:23.267+08:00","updated_at":"2020-12-01T18:55:23.267+08:00"},{"id":3633705,"file_name":"1.png","project_id":208589,"asset_id":288124,"created_at":"2020-12-01T18:55:22.660+08:00","updated_at":"2020-12-01T18:55:22.660+08:00"},{"id":3633706,"file_name":"2.png","project_id":208589,"asset_id":288125,"created_at":"2020-12-01T18:55:22.661+08:00","updated_at":"2020-12-01T18:55:22.661+08:00"},{"id":3633698,"file_name":"bgm.mp3","project_id":208589,"asset_id":280216,"created_at":"2020-12-01T18:50:16.261+08:00","updated_at":"2020-12-01T18:50:16.261+08:00"},{"id":3633699,"file_name":"shot.mp3","project_id":208589,"asset_id":280214,"created_at":"2020-12-01T18:50:16.262+08:00","updated_at":"2020-12-01T18:50:16.262+08:00"},{"id":3636365,"file_name":"shadow.png","project_id":208589,"asset_id":280210,"created_at":"2020-12-02T11:33:51.680+08:00","updated_at":"2020-12-02T11:33:51.680+08:00"},{"id":3680742,"file_name":"dashboard.png","project_id":208589,"asset_id":291652,"created_at":"2020-12-10T21:52:28.856+08:00","updated_at":"2020-12-10T21:52:28.856+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦