{"id":252479,"student_id":10,"content":"from game import *\nimport random\n\ngame.set_backdrop(\"bg.png\") #設定背景\nboard = create_sprite('dashboard.png') #計分板\nt1 = create_sprite('0.png', '1.png', '2.png', '3.png') #人物1\nt2 = create_sprite('0.png', '1.png', '2.png', '3.png') #人物2\nt3 = create_sprite('0.png', '1.png', '2.png', '3.png') #人物3\nbg = create_sprite('building.png') #建築物\nshadow = create_sprite('shadow.png') #狙擊鏡\nshadow.hidden = True\n\nboard.move_to(150, 75)\n\nclock = 0 #紀錄遊戲迴圈次數\nkill = 0 #擊殺次數\nmiss = 0 #誤殺次數\n\n# create_sound('bgm.mp3')\n\nt1.x = t2.x = t3.x = 2000 #預設直接移出場景\n\n#遊戲主迴圈\ndef loop():\n global clock, kill, miss\n clock += 1\n \n if clock % 120 == 0 or t1.touched(t2) or t1.touched(t3):\n t1.costume_id = random.randrange(3)\n t1.x = random.randrange(6) * 200 + 100\n t1.y = random.randrange(4) * 200 + 165\n \n if clock % 120 == 40 or t2.touched(t1) or t2.touched(t3):\n t2.costume_id = random.randrange(3)\n t2.x = random.randrange(6) * 200 + 100\n t2.y = random.randrange(4) * 200 + 165\n \n if clock % 120 == 80 or t3.touched(t1) or t3.touched(t2):\n t3.costume_id = random.randrange(3)\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 != 3:\n if t1.costume_id == 2: kill += 1\n else: miss += 1\n t1.costume_id = 3\n create_sound('shot.mp3')\n \n if cursor.is_down and t2.touched(cursor) and t2.costume_id != 3:\n if t2.costume_id == 2: kill += 1\n else: miss += 1\n t2.costume_id = 3\n create_sound('shot.mp3')\n \n if cursor.is_down and t3.touched(cursor) and t3.costume_id != 3:\n if t3.costume_id == 2: kill += 1\n else: miss += 1\n t3.costume_id = 3\n create_sound('shot.mp3')\n \n if clock == 1800:\n shadow.hidden = True\n stop()\n \n draw_text('擊殺: ' + str(kill), 30, 30, 'white', 40)\n draw_text('誤殺: ' + str(miss), 30, 80, 'white', 40)\n \n shadow.x = cursor.x\n shadow.y = cursor.y\n\nforever(loop) #重複不斷執行","created_at":"2021-05-13T14:55:21.996+08:00","updated_at":"2021-05-13T15:19:53.484+08:00","name":"狙擊之王(完整版) 副本","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/252479/c899fa77e949bbec503421253ae328c9.jpg"},"parent_id":210634,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":233,"hashid":"ej9s285p4","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4778283,"file_name":"3.png","project_id":252479,"asset_id":352301,"created_at":"2021-05-13T14:55:22.004+08:00","updated_at":"2021-05-13T14:55:22.004+08:00"},{"id":4778284,"file_name":"2.png","project_id":252479,"asset_id":352300,"created_at":"2021-05-13T14:55:22.005+08:00","updated_at":"2021-05-13T14:55:22.005+08:00"},{"id":4778285,"file_name":"1.png","project_id":252479,"asset_id":352299,"created_at":"2021-05-13T14:55:22.006+08:00","updated_at":"2021-05-13T14:55:22.006+08:00"},{"id":4778286,"file_name":"shot.mp3","project_id":252479,"asset_id":352298,"created_at":"2021-05-13T14:55:22.007+08:00","updated_at":"2021-05-13T14:55:22.007+08:00"},{"id":4778287,"file_name":"bgm.mp3","project_id":252479,"asset_id":352297,"created_at":"2021-05-13T14:55:22.008+08:00","updated_at":"2021-05-13T14:55:22.008+08:00"},{"id":4778282,"file_name":"gameover.png","project_id":252479,"asset_id":202098,"created_at":"2021-05-13T14:55:22.003+08:00","updated_at":"2021-05-13T14:55:22.003+08:00"},{"id":4778288,"file_name":"dashboard.png","project_id":252479,"asset_id":352296,"created_at":"2021-05-13T14:55:22.009+08:00","updated_at":"2021-05-13T14:55:22.009+08:00"},{"id":4778289,"file_name":"building.png","project_id":252479,"asset_id":352295,"created_at":"2021-05-13T14:55:22.010+08:00","updated_at":"2021-05-13T14:55:22.010+08:00"},{"id":4778290,"file_name":"bg.png","project_id":252479,"asset_id":352294,"created_at":"2021-05-13T14:55:22.011+08:00","updated_at":"2021-05-13T14:55:22.011+08:00"},{"id":4778291,"file_name":"shadow.png","project_id":252479,"asset_id":352293,"created_at":"2021-05-13T14:55:22.012+08:00","updated_at":"2021-05-13T14:55:22.012+08:00"},{"id":4778292,"file_name":"0.png","project_id":252479,"asset_id":352292,"created_at":"2021-05-13T14:55:22.013+08:00","updated_at":"2021-05-13T14:55:22.013+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦