{"id":162839,"student_id":2589,"content":"import game\nimport random #載入產生隨機數的套件\n\ngame.create_sprite('bg_0.png') #背景圖1\nc1 = game.create_sprite('cloud_1.png') #雲朵1\nc2 = game.create_sprite('cloud_2.png') #雲朵2\nc3 = game.create_sprite('cloud_3.png') #雲朵3\ngame.create_sprite('bg_1.png') #背景圖2\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') #遊戲說明\ninfo.hidden = False\np1.hidden = True\np2.hidden = True\nsteps = -1 #移動的剩餘步數\ngame_over = True #遊戲狀態\n\nbgm = game.create_sound('bgm.mp3')\n\np1.x = 600\np1.y = 700\np2.x = 600\np2.y = 700\nc1.x = 700\nc1.y = 300\nc2.x = 200 \nc2.y = 150\nc3.x = 1100\nc3.y = 50\n\n# 遊戲主迴圈\ndef loop ():\n global steps, game_over\n if steps \u003e 0:\n p1.x -= 1\n p2.x += 1\n steps -= 1\n \n if steps == 0:\n p1.costume_id = 1\n p2.costume_id = 1\n steps = -1\n bgm.mute(True)\n \n costume_id\n\n #重新開始\n if key.r and game_over == True:\n p1.x = 600\n p1.y = 700\n p2.x = 600\n p2.y = 700\n p1.costume_id = 0\n p2.costume_id = 0\n steps = random.randint(100, 500)\n game_over = False\n p1.hidden = False\n p2.hidden = False\n info.hidden = True\n bgm.mute(False)\n\n c1.x -= 0.3\n if c1.x \u003c -200:\n c1.x += 1500\n\n c2.x -= 0.5\n if c2.x \u003c -200:\n c2.x += 1500\n \n c3.x -= 0.7\n if c3.x \u003c -200:\n c3.x += 1500\n\ngame.forever(loop) #不斷執行遊戲迴圈","created_at":"2020-07-06T01:08:57.660+08:00","updated_at":"2020-08-11T18:00:06.821+08:00","name":"牛仔大對決_T ","language":"python","screenshot":{"url":"https://cdn1.koding.school/uploads/project/screenshot/162839/e96bb17a401c779a3402871e12d044ca.jpg"},"parent_id":160617,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":166,"hashid":"p93s9yee","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2832515,"file_name":"bg_0.png","project_id":162839,"asset_id":192575,"created_at":"2020-07-06T01:08:57.666+08:00","updated_at":"2020-07-06T01:08:57.666+08:00"},{"id":2832516,"file_name":"bg_1.png","project_id":162839,"asset_id":192574,"created_at":"2020-07-06T01:08:57.667+08:00","updated_at":"2020-07-06T01:08:57.667+08:00"},{"id":2832517,"file_name":"bgm.mp3","project_id":162839,"asset_id":172549,"created_at":"2020-07-06T01:08:57.668+08:00","updated_at":"2020-07-06T01:08:57.668+08:00"},{"id":2832518,"file_name":"cloud_1.png","project_id":162839,"asset_id":192679,"created_at":"2020-07-06T01:08:57.669+08:00","updated_at":"2020-07-06T01:08:57.669+08:00"},{"id":2832519,"file_name":"cloud_2.png","project_id":162839,"asset_id":192577,"created_at":"2020-07-06T01:08:57.670+08:00","updated_at":"2020-07-06T01:08:57.670+08:00"},{"id":2832520,"file_name":"cloud_3.png","project_id":162839,"asset_id":192578,"created_at":"2020-07-06T01:08:57.671+08:00","updated_at":"2020-07-06T01:08:57.671+08:00"},{"id":2832521,"file_name":"info.png","project_id":162839,"asset_id":192685,"created_at":"2020-07-06T01:08:57.672+08:00","updated_at":"2020-07-06T01:08:57.672+08:00"},{"id":2832522,"file_name":"p1_0.png","project_id":162839,"asset_id":192671,"created_at":"2020-07-06T01:08:57.673+08:00","updated_at":"2020-07-06T01:08:57.673+08:00"},{"id":2832523,"file_name":"p1_1.png","project_id":162839,"asset_id":192672,"created_at":"2020-07-06T01:08:57.673+08:00","updated_at":"2020-07-06T01:08:57.673+08:00"},{"id":2832524,"file_name":"p1_2.png","project_id":162839,"asset_id":192673,"created_at":"2020-07-06T01:08:57.674+08:00","updated_at":"2020-07-06T01:08:57.674+08:00"},{"id":2832525,"file_name":"p1_3.png","project_id":162839,"asset_id":192674,"created_at":"2020-07-06T01:08:57.675+08:00","updated_at":"2020-07-06T01:08:57.675+08:00"},{"id":2832526,"file_name":"p2_0.png","project_id":162839,"asset_id":192675,"created_at":"2020-07-06T01:08:57.676+08:00","updated_at":"2020-07-06T01:08:57.676+08:00"},{"id":2832527,"file_name":"p2_1.png","project_id":162839,"asset_id":192676,"created_at":"2020-07-06T01:08:57.677+08:00","updated_at":"2020-07-06T01:08:57.677+08:00"},{"id":2832528,"file_name":"p2_2.png","project_id":162839,"asset_id":192677,"created_at":"2020-07-06T01:08:57.678+08:00","updated_at":"2020-07-06T01:08:57.678+08:00"},{"id":2832529,"file_name":"p2_3.png","project_id":162839,"asset_id":192678,"created_at":"2020-07-06T01:08:57.679+08:00","updated_at":"2020-07-06T01:08:57.679+08:00"},{"id":2832530,"file_name":"shot.wav","project_id":162839,"asset_id":17859,"created_at":"2020-07-06T01:08:57.685+08:00","updated_at":"2020-07-06T01:08:57.685+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦