{"id":311133,"student_id":3525,"content":"import game #載入遊戲套件\nimport random #載入產生隨機數的套件\n\ngame.create_sprite('bg_0.png') #背景圖1\nc1 = game.create_sprite(\"cloud_1.png\")\nc2 = game.create_sprite(\"cloud_2.png\")\nc3 = game.create_sprite(\"cloud_3.png\")\nc4 = game.create_sprite(\"cloud_4.png\")\ngame.create_sprite('bg_1.png') #背景圖2\n\ninfo = game.create_sprite(\"info.png\")\np1 = game.create_sprite('p1_0.png', 'p1_1.png', 'p1_2.png', 'p1_3.png')\np2 = game.create_sprite('p2_0.png', 'p2_1.png', 'p2_2.png', 'p2_3.png')\n\nbgm = game.create_sound(\"bgm.mp3\", True)\n\np1.move_to(600, 700)\np2.move_to(600, 700)\nc1.move_to(700, 300)\nc2.move_to(300, 150)\nc3.move_to(1000, 100)\nc4.move_to(100, 230)\n\nsteps = random.randint(100,500)\np1_activation = False\np2_activation = False\np1.hidden = True\np2.hidden = True\ninfo.hidden = False\nspeed = 0\n\n# 遊戲主迴圈\ndef loop ():\n global steps, p1_activation, p2_activation, speed\n \n if steps \u003e 0:\n p1.x -= 1\n p2.x += 1\n steps -= 1\n \n if steps \u003c= 0 and p1.costume_id == 0 and info.hidden == True:\n p1.costume_id = 1\n p2.costume_id = 1\n bgm.mute(True)\n \n if game.key.space == True and p1.costume_id != 1:\n p1_activation = True\n \n if game.key.enter == True and p2.costume_id != 1:\n p2_activation = True\n \n if game.key.space == True and p1.costume_id == 1 and p1_activation == False and info.hidden == True:\n p1.costume_id = 2\n p2.costume_id = 3\n game.create_sound(\"shot.wav\")\n \n if game.key.enter == True and p2.costume_id == 1 and p2_activation == False and info.hidden == True:\n p1.costume_id = 3\n p2.costume_id = 2\n game.create_sound(\"shot.wav\")\n \n if game.key.r == True:\n p1.move_to(600, 700)\n p2.move_to(600, 700)\n p1.costume_id = 0\n p2.costume_id = 0\n steps = random.randint(100,500)\n p1_activation = False\n p2_activation = False\n p1.hidden = False\n p2.hidden = False\n info.hidden = True\n bgm.mute(False)\n \n c1.x -= 15\n c1.direction += 14\n c2.y -= 36\n c3.y += speed\n speed += 0.04\n c4.x -= 3\n if c1.x \u003c= -250:\n c1.x += 1550\n if c2.y \u003c= -200:\n c2.y += 1100\n if c3.y \u003e= 700:\n c3.y -= 900\n if c4.x \u003c= -20:\n c4.x += 1500\nforever(loop) #不斷執行遊戲迴圈","created_at":"2021-11-06T10:09:37.054+08:00","updated_at":"2023-10-28T23:07:28.096+08:00","name":"牛仔大對決(預設版) 副本","language":"python","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/311133/23f7619f49d3f5bbf017bee6f930c32c.jpg"},"parent_id":183412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":80,"hashid":"qmds8ppe6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6377392,"file_name":"shot.wav","project_id":311133,"asset_id":251747,"created_at":"2021-11-06T10:09:37.064+08:00","updated_at":"2021-11-06T10:09:37.064+08:00"},{"id":6377393,"file_name":"p2_3.png","project_id":311133,"asset_id":251748,"created_at":"2021-11-06T10:09:37.066+08:00","updated_at":"2021-11-06T10:09:37.066+08:00"},{"id":6377394,"file_name":"p2_2.png","project_id":311133,"asset_id":251749,"created_at":"2021-11-06T10:09:37.068+08:00","updated_at":"2021-11-06T10:09:37.068+08:00"},{"id":6377395,"file_name":"p2_1.png","project_id":311133,"asset_id":251750,"created_at":"2021-11-06T10:09:37.070+08:00","updated_at":"2021-11-06T10:09:37.070+08:00"},{"id":6377396,"file_name":"p2_0.png","project_id":311133,"asset_id":251751,"created_at":"2021-11-06T10:09:37.071+08:00","updated_at":"2021-11-06T10:09:37.071+08:00"},{"id":6377397,"file_name":"p1_3.png","project_id":311133,"asset_id":251752,"created_at":"2021-11-06T10:09:37.073+08:00","updated_at":"2021-11-06T10:09:37.073+08:00"},{"id":6377398,"file_name":"p1_2.png","project_id":311133,"asset_id":251753,"created_at":"2021-11-06T10:09:37.075+08:00","updated_at":"2021-11-06T10:09:37.075+08:00"},{"id":6377399,"file_name":"p1_1.png","project_id":311133,"asset_id":251754,"created_at":"2021-11-06T10:09:37.076+08:00","updated_at":"2021-11-06T10:09:37.076+08:00"},{"id":6377400,"file_name":"p1_0.png","project_id":311133,"asset_id":251755,"created_at":"2021-11-06T10:09:37.078+08:00","updated_at":"2021-11-06T10:09:37.078+08:00"},{"id":6377401,"file_name":"info.png","project_id":311133,"asset_id":251756,"created_at":"2021-11-06T10:09:37.080+08:00","updated_at":"2021-11-06T10:09:37.080+08:00"},{"id":6377402,"file_name":"cloud_3.png","project_id":311133,"asset_id":251757,"created_at":"2021-11-06T10:09:37.081+08:00","updated_at":"2021-11-06T10:09:37.081+08:00"},{"id":6377403,"file_name":"cloud_2.png","project_id":311133,"asset_id":251758,"created_at":"2021-11-06T10:09:37.083+08:00","updated_at":"2021-11-06T10:09:37.083+08:00"},{"id":6377404,"file_name":"cloud_1.png","project_id":311133,"asset_id":251759,"created_at":"2021-11-06T10:09:37.086+08:00","updated_at":"2021-11-06T10:09:37.086+08:00"},{"id":6377406,"file_name":"bg_1.png","project_id":311133,"asset_id":251761,"created_at":"2021-11-06T10:09:37.089+08:00","updated_at":"2021-11-06T10:09:37.089+08:00"},{"id":6377407,"file_name":"bg_0.png","project_id":311133,"asset_id":251762,"created_at":"2021-11-06T10:09:37.091+08:00","updated_at":"2021-11-06T10:09:37.091+08:00"},{"id":6377405,"file_name":"notbgm.mp3","project_id":311133,"asset_id":251760,"created_at":"2021-11-06T10:09:37.088+08:00","updated_at":"2021-11-06T11:15:20.528+08:00"},{"id":6386945,"file_name":"bgm.mp3","project_id":311133,"asset_id":433355,"created_at":"2021-11-06T11:15:14.647+08:00","updated_at":"2021-11-06T11:15:25.011+08:00"},{"id":6387673,"file_name":"cloud_4.png","project_id":311133,"asset_id":433440,"created_at":"2021-11-06T11:32:12.610+08:00","updated_at":"2021-11-06T11:32:17.663+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦