{"id":122023,"student_id":10,"content":"import random #引入隨機函式庫\nimport game\n\nsetBackdrop('bg.png') #設定背景圖\np1 = createSprite('pipes.png') #1號水管\np2 = createSprite('pipes.png') #2號水管\np3 = createSprite('pipes.png') #3號水管\ngd = createSprite('ground.png') #地板\nbird = createSprite('bird_1.png', 'bird_2.png') #小鳥\nhint = createSprite('hint.png') #按鍵示意圖\nend = createSprite('gameover.png') #遊戲結束示意圖\n\n# hint.hidden = True\nend.hidden = True\n\nspeed = 0 #鳥的垂直速度\nscore = 0 #遊戲分數\nstart = False #是否開始遊戲\n\np1.x = 0\np2.x = 500\np3.x = 1000\n\n#遊戲迴圈\ndef loop():\n moveGround() #捲動地板\n movePipes(p1) #移動1號水管\n movePipes(p2) #移動2號水管\n movePipes(p3) #移動3號水管\n moveBird() #移動鳥\n \n if bird.touched([p1, p2, p3, gd]):\n stop()\n end.hidden = False\n createSound('gg.mp3')\n \n drawText(score, 10, 10, 'white')\n\n#移動地板\ndef moveGround ():\n gd.x = gd.x - 6\n if gd.x \u003c 0:\n gd.x = gd.x + 1200\n\n#移動水管\ndef movePipes (pipe):\n global start, score\n \n pipe.x = pipe.x - 6\n if pipe.x \u003c -100:\n pipe.x = pipe.x + 1500\n if start == True:\n pipe.y = random.random()*500 + 150\n score = score + 1\n\n#鳥的墜落 \u0026 翅膀動畫\ndef moveBird ():\n global start, speed\n if start:\n speed = speed + 0.8\n bird.y = bird.y + speed\n if speed \u003e 0:\n bird.costumeId = 0\n if speed \u003c 0:\n bird.costumeId = 1\n \n#鳥的跳躍\ndef jump ():\n global speed, start\n speed = -12\n start = True\n hint.hidden = True\n sound.play('jump.mp3')\n\n\nforever(loop) #不斷執行遊戲迴圈\non('keydown', jump) #按下任意按鍵使鳥跳躍\ncreateSound('bgm.mp3', True) #播放背景音樂\n","created_at":"2020-01-30T11:28:13.887+08:00","updated_at":"2020-03-29T15:50:17.454+08:00","name":"Flappy Bird - 完整版","language":"python","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/122023/36eaa0e7bad811f976df61bc81c368b7.jpg"},"parent_id":4,"plugin":"game.set({'width': 1200, 'height': 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":259,"hashid":"36ys9yn9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2377037,"file_name":"ground.png","project_id":122023,"asset_id":189063,"created_at":"2020-03-29T09:33:04.556+08:00","updated_at":"2020-03-29T09:33:04.556+08:00"},{"id":2377038,"file_name":"hint.png","project_id":122023,"asset_id":189068,"created_at":"2020-03-29T09:33:04.559+08:00","updated_at":"2020-03-29T09:33:04.559+08:00"},{"id":2377039,"file_name":"pipes.png","project_id":122023,"asset_id":189065,"created_at":"2020-03-29T09:33:04.807+08:00","updated_at":"2020-03-29T09:33:04.807+08:00"},{"id":2377042,"file_name":"gg.mp3","project_id":122023,"asset_id":36479,"created_at":"2020-03-29T09:47:31.789+08:00","updated_at":"2020-03-29T09:47:31.789+08:00"},{"id":2377043,"file_name":"bgm.mp3","project_id":122023,"asset_id":172841,"created_at":"2020-03-29T09:47:33.392+08:00","updated_at":"2020-03-29T09:47:33.392+08:00"},{"id":2377033,"file_name":"bg.png","project_id":122023,"asset_id":189059,"created_at":"2020-03-29T09:33:04.034+08:00","updated_at":"2020-03-29T09:33:04.034+08:00"},{"id":2377034,"file_name":"bird_1.png","project_id":122023,"asset_id":189060,"created_at":"2020-03-29T09:33:04.039+08:00","updated_at":"2020-03-29T09:33:04.039+08:00"},{"id":2377035,"file_name":"bird_2.png","project_id":122023,"asset_id":189061,"created_at":"2020-03-29T09:33:04.279+08:00","updated_at":"2020-03-29T09:33:04.279+08:00"},{"id":2377036,"file_name":"gameover.png","project_id":122023,"asset_id":189062,"created_at":"2020-03-29T09:33:04.281+08:00","updated_at":"2020-03-29T09:33:04.281+08:00"},{"id":2380248,"file_name":"jump.mp3","project_id":122023,"asset_id":201868,"created_at":"2020-03-29T15:42:43.020+08:00","updated_at":"2020-03-29T15:42:43.020+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦