{"id":42828,"student_id":70,"content":"import game\nimport random\n\nGame = game\n\nGame.setBackdrop(\"bg.jpg\")\nbird = Game.createSprite(\"bird.png\")\ntubes = Game.createSprite(\"tubes.png\")\nground = Game.createSprite(\"ground.jpg\")\ntubes.x = 640\ntubes.scored = False\nground.y = 480\nbird.vy = 0\n\nstate = \"wait\" # \"playing\"\nscore = 0\n\ndef reset_tubes():\n tubes.x = 660\n tubes.y = 240 + random.randint(-100, 100)\n tubes.scored = False\n \ndef update():\n global score, state\n if state==\"wait\":\n Game.print(\"Click screen to start!\", 50, 200, \"black\", 32)\n if Game.cursor.isDown: state = \"playing\"\n elif state==\"playing\":\n Game.print(score, 32, 32, \"black\", 32)\n tubes.x -= 3\n bird.vy += 0.3\n bird.y += bird.vy\n if tubes.x\u003c-20:\n reset_tubes()\n if Game.cursor.isDown:\n bird.vy = -5\n if bird.touched(ground) or bird.touched(tubes):\n Game.stop()\n if bird.x\u003etubes.x and tubes.scored==False:\n score += 1\n tubes.scored = True\n \nGame.forever(update)\n\n\n","created_at":"2018-09-16T17:15:03.510+08:00","updated_at":"2020-05-19T17:04:45.822+08:00","name":"Flappy bird","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/42828/78c61e7f1ead7988a942b4dbd445e807.jpg"},"parent_id":null,"plugin":null,"description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":273,"hashid":"gk4s89pq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":751945,"file_name":"bg.jpg","project_id":42828,"asset_id":4,"created_at":"2018-09-16T17:15:47.927+08:00","updated_at":"2018-09-16T17:15:47.927+08:00"},{"id":751946,"file_name":"bird.png","project_id":42828,"asset_id":1,"created_at":"2018-09-16T17:15:47.930+08:00","updated_at":"2018-09-16T17:15:47.930+08:00"},{"id":751947,"file_name":"ground.jpg","project_id":42828,"asset_id":5,"created_at":"2018-09-16T17:15:48.701+08:00","updated_at":"2018-09-16T17:15:48.701+08:00"},{"id":751948,"file_name":"tubes.png","project_id":42828,"asset_id":12504,"created_at":"2018-09-16T17:15:48.703+08:00","updated_at":"2018-09-16T17:15:48.703+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦