{"id":382670,"student_id":2589,"content":"from game import *\nimport random\n\ngame.set_backdrop(\"bg.png\") #設定背景\nboard = create_sprite('dashboard.png') #計分板\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# shadow.opacity = 0.8\nboard.move_to(150, 75)\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 draw_text('擊殺: ' + str(kill), 30, 30, 'white', 40)\n draw_text('誤殺: ' + str(miss), 30, 80, 'white', 40)\n if clock == 3600:\n shadow.hidden = True\n stop()\n \n shadow.x = cursor.x\n shadow.y = cursor.y\n\nforever(loop) #重複不斷執行遊戲迴圈","created_at":"2022-05-23T11:51:36.928+08:00","updated_at":"2022-05-23T11:55:50.028+08:00","name":"狙擊之王(預設版) ","language":"python","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/382670/0c1fe85f0d999f652b25594b6f0a71d0.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":62,"hashid":"meyswrqjn","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":8546424,"file_name":"0.png","project_id":382670,"asset_id":507892,"created_at":"2022-05-23T11:52:03.320+08:00","updated_at":"2022-05-23T11:52:03.320+08:00"},{"id":8546425,"file_name":"shadow.png","project_id":382670,"asset_id":507893,"created_at":"2022-05-23T11:52:03.324+08:00","updated_at":"2022-05-23T11:52:03.324+08:00"},{"id":8546426,"file_name":"bg.png","project_id":382670,"asset_id":507894,"created_at":"2022-05-23T11:52:03.331+08:00","updated_at":"2022-05-23T11:52:03.331+08:00"},{"id":8546427,"file_name":"building.png","project_id":382670,"asset_id":507895,"created_at":"2022-05-23T11:52:03.335+08:00","updated_at":"2022-05-23T11:52:03.335+08:00"},{"id":8546428,"file_name":"dashboard.png","project_id":382670,"asset_id":507896,"created_at":"2022-05-23T11:52:03.339+08:00","updated_at":"2022-05-23T11:52:03.339+08:00"},{"id":8546429,"file_name":"bgm.mp3","project_id":382670,"asset_id":507897,"created_at":"2022-05-23T11:52:03.451+08:00","updated_at":"2022-05-23T11:52:03.451+08:00"},{"id":8546430,"file_name":"shot.mp3","project_id":382670,"asset_id":507898,"created_at":"2022-05-23T11:52:03.457+08:00","updated_at":"2022-05-23T11:52:03.457+08:00"},{"id":8546431,"file_name":"1.png","project_id":382670,"asset_id":507899,"created_at":"2022-05-23T11:52:03.461+08:00","updated_at":"2022-05-23T11:52:03.461+08:00"},{"id":8546432,"file_name":"2.png","project_id":382670,"asset_id":507900,"created_at":"2022-05-23T11:52:03.465+08:00","updated_at":"2022-05-23T11:52:03.465+08:00"},{"id":8546433,"file_name":"3.png","project_id":382670,"asset_id":507901,"created_at":"2022-05-23T11:52:03.469+08:00","updated_at":"2022-05-23T11:52:03.469+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦