{"id":355852,"student_id":3544,"content":"import game #載入遊戲套件\nimport random #載入產生隨機數的套件\n\ngame.create_sprite('bg_0.png')\nc1=game.create_sprite('cloud_1.png')#背景圖1\ngame.create_sprite('bg_1.png') \n\n\nc2=game.create_sprite('cloud_2.png')\nc3=game.create_sprite('cloud_3.png')\nstep=random.randrange\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')\ninfo= game.create_sprite('info.png')\nbgm=game.create_sound('bgm.mp3',True)\np1.move_to(600, 700)\np2.move_to(600, 700)\nc1.move_to(700,300)\nc2.move_to(200,150)\nc3.move_to(1150,50)\nsteps=random.randint(100,500)\np1shoot=False\np2shoot=False\np1.hidden=True\np2.hidden=True\np1victory=0\np2victory=0\np1point=0\np2point=0\n# 遊戲主迴圈\ndef loop ():\n global steps, p1shoot , p2shoot,bgm,c1,c2,c3,p1point,p2point,p1victory,p2victory\n game.draw_text(p1point, 30, 20, 'black', 80)\n game.draw_text(p2point, 1140, 20, 'black', 80)\n c1.x-=2\n c2.x-=1.4\n c3.x-=0.8\n if p1point==5 :\n \n p1victory+=1\n game.draw_text('p1勝利次數+1', 800, 500, 'black', 80)\n if p2point==5 :\n \n p2victory+=1\n game.draw_text('p2勝利次數+1', 800, 20, 'black', 80)\n if c1.x\u003c-200:\n c1.x+=1500\n if c2.x\u003c-200:\n c2.x+=1500\n if c3.x\u003c-200:\n c3.x+=1500 \n if steps\u003e0 and info.hidden==True :\n p1.x-=1\n p2.x+=1\n steps-=1\n if steps==0 and p1.costume_id==0 :\n bgm.mute(True)\n p1.costume_id=1\n p2.costume_id=1\n if game.key.space==True and p1.costume_id==1 and p1shoot==False:\n game.create_sound('shot.wav')\n p1.costume_id=2\n p2.costume_id=3\n p1point+=1\n if game.key.enter==True and p2.costume_id==1 and p2shoot==False:\n game.create_sound('shot.wav')\n p2.costume_id=2\n p1.costume_id=3\n p2point+=1\n if game.key.space==True :\n p1shoot=True\n if game.key.enter==True :\n p2shoot=True\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 bgm.mute(False)\n p1shoot=False\n p2shoot=False\n p1.hidden=False\n p2.hidden=False\n info.hidden=True\n steps=random.randint(100,500)\n \nforever(loop) #不斷執行遊戲迴圈","created_at":"2022-03-12T13:52:22.569+08:00","updated_at":"2022-03-12T15:06:37.598+08:00","name":"牛仔大對決(預設版) 副本","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/355852/d5d8d90c50346241ad10934a3bdaf682.jpg"},"parent_id":183412,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":53,"hashid":"yeysv928r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":7766262,"file_name":"shot.wav","project_id":355852,"asset_id":251747,"created_at":"2022-03-12T13:52:22.577+08:00","updated_at":"2022-03-12T13:52:22.577+08:00"},{"id":7766264,"file_name":"p2_3.png","project_id":355852,"asset_id":251748,"created_at":"2022-03-12T13:52:22.579+08:00","updated_at":"2022-03-12T13:52:22.579+08:00"},{"id":7766267,"file_name":"p2_2.png","project_id":355852,"asset_id":251749,"created_at":"2022-03-12T13:52:22.581+08:00","updated_at":"2022-03-12T13:52:22.581+08:00"},{"id":7766268,"file_name":"p2_1.png","project_id":355852,"asset_id":251750,"created_at":"2022-03-12T13:52:22.582+08:00","updated_at":"2022-03-12T13:52:22.582+08:00"},{"id":7766270,"file_name":"p2_0.png","project_id":355852,"asset_id":251751,"created_at":"2022-03-12T13:52:22.583+08:00","updated_at":"2022-03-12T13:52:22.583+08:00"},{"id":7766272,"file_name":"p1_3.png","project_id":355852,"asset_id":251752,"created_at":"2022-03-12T13:52:22.584+08:00","updated_at":"2022-03-12T13:52:22.584+08:00"},{"id":7766274,"file_name":"p1_2.png","project_id":355852,"asset_id":251753,"created_at":"2022-03-12T13:52:22.586+08:00","updated_at":"2022-03-12T13:52:22.586+08:00"},{"id":7766276,"file_name":"p1_1.png","project_id":355852,"asset_id":251754,"created_at":"2022-03-12T13:52:22.587+08:00","updated_at":"2022-03-12T13:52:22.587+08:00"},{"id":7766278,"file_name":"p1_0.png","project_id":355852,"asset_id":251755,"created_at":"2022-03-12T13:52:22.588+08:00","updated_at":"2022-03-12T13:52:22.588+08:00"},{"id":7766280,"file_name":"info.png","project_id":355852,"asset_id":251756,"created_at":"2022-03-12T13:52:22.589+08:00","updated_at":"2022-03-12T13:52:22.589+08:00"},{"id":7766281,"file_name":"cloud_3.png","project_id":355852,"asset_id":251757,"created_at":"2022-03-12T13:52:22.590+08:00","updated_at":"2022-03-12T13:52:22.590+08:00"},{"id":7766283,"file_name":"cloud_2.png","project_id":355852,"asset_id":251758,"created_at":"2022-03-12T13:52:22.592+08:00","updated_at":"2022-03-12T13:52:22.592+08:00"},{"id":7766285,"file_name":"cloud_1.png","project_id":355852,"asset_id":251759,"created_at":"2022-03-12T13:52:22.593+08:00","updated_at":"2022-03-12T13:52:22.593+08:00"},{"id":7766287,"file_name":"bgm.mp3","project_id":355852,"asset_id":251760,"created_at":"2022-03-12T13:52:22.594+08:00","updated_at":"2022-03-12T13:52:22.594+08:00"},{"id":7766289,"file_name":"bg_1.png","project_id":355852,"asset_id":251761,"created_at":"2022-03-12T13:52:22.596+08:00","updated_at":"2022-03-12T13:52:22.596+08:00"},{"id":7766291,"file_name":"bg_0.png","project_id":355852,"asset_id":251762,"created_at":"2022-03-12T13:52:22.597+08:00","updated_at":"2022-03-12T13:52:22.597+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦