{"id":169741,"student_id":10,"content":"import game #載入遊戲框架\nimport random #載入產生隨機數的套件\n\ngame.set_backdrop('bg.png') #設定背景圖\np1 = game.create_sprite('pipes.png') #1號水管\np2 = game.create_sprite('pipes.png') #2號水管\np3 = game.create_sprite('pipes.png') #3號水管\ngd = game.create_sprite('ground.png') #地板\nbird = game.create_sprite('bird_0.png', 'bird_1.png') #小鳥\nhint = game.create_sprite('hint.png') #按鍵示意圖\nend = game.create_sprite('gameover.png') #遊戲結束示意圖\n\nhint.hidden = True #隱藏操作圖示\nend.hidden = True #隱藏 gameover 圖示\n\nscore = 0 #遊戲分數\nspeed = 0 #鳥的垂直速度\nstart = False #是否開始遊戲\n\np1.x = 0\np2.x = 500\np3.x = 1000\n\n\n#遊戲主迴圈\ndef loop():\n moveGround() #捲動地板\n movePipes(p1) #移動1號水管\n movePipes(p2) #移動2號水管\n movePipes(p3) #移動3號水管\n moveBird() #移動鳥\n \n game.draw_text(score, 30, 30, 'white', 60)\n\n\n#捲動地板\ndef moveGround ():\n gd.x = gd.x - 6\n if gd.x \u003c 0:\n gd.x = gd.x + 1200\n\n\n#移動水管\ndef movePipes (pipe):\n global score\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.randrange(150, 650)\n score = score + 1\n\n\n#鳥的墜落 \u0026 翅膀動畫\ndef moveBird ():\n global speed\n if start == True:\n speed = speed + 0.8\n bird.y = bird.y + speed\n\n\n#鳥的跳躍\ndef jump ():\n global speed, start\n speed = -12\n start = True\n\n\n# 遊戲結束\ndef gameover (t):\n game.stop()\n\n\ngame.forever(loop) #不斷執行遊戲主迴圈\ngame.on('keydown', jump) #按下任意按鍵使鳥跳躍\nbird.on('touch', [p1, p2, p3, gd], gameover) #鳥撞到水管或地板就結束遊戲\n\n","created_at":"2020-07-23T14:01:21.229+08:00","updated_at":"2024-01-16T13:39:36.074+08:00","name":"跳躍吧!小鳥(錄音版)","language":"python","screenshot":{"url":"/uploads/project/screenshot/169741/42a455fa1fc3b82927a0ef27fae354b3.jpg"},"parent_id":169701,"plugin":"game.set({'width': 1200, 'height': 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":392,"hashid":"meysdqd3","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2932030,"file_name":"bg.png","project_id":169741,"asset_id":201954,"created_at":"2020-07-23T14:01:21.235+08:00","updated_at":"2020-07-23T14:01:21.235+08:00"},{"id":2932031,"file_name":"gameover.png","project_id":169741,"asset_id":201957,"created_at":"2020-07-23T14:01:21.236+08:00","updated_at":"2020-07-23T14:01:21.236+08:00"},{"id":2932032,"file_name":"ground.png","project_id":169741,"asset_id":201958,"created_at":"2020-07-23T14:01:21.238+08:00","updated_at":"2020-07-23T14:01:21.238+08:00"},{"id":2932033,"file_name":"pipes.png","project_id":169741,"asset_id":201960,"created_at":"2020-07-23T14:01:21.239+08:00","updated_at":"2020-07-23T14:01:21.239+08:00"},{"id":2932034,"file_name":"bgm.mp3","project_id":169741,"asset_id":201962,"created_at":"2020-07-23T14:01:21.240+08:00","updated_at":"2020-07-23T14:01:21.240+08:00"},{"id":2932035,"file_name":"jump.mp3","project_id":169741,"asset_id":201963,"created_at":"2020-07-23T14:01:21.241+08:00","updated_at":"2020-07-23T14:01:21.241+08:00"},{"id":2932036,"file_name":"gg.mp3","project_id":169741,"asset_id":202597,"created_at":"2020-07-23T14:01:21.242+08:00","updated_at":"2020-07-23T14:01:21.242+08:00"},{"id":2932037,"file_name":"hint.png","project_id":169741,"asset_id":202593,"created_at":"2020-07-23T14:01:21.243+08:00","updated_at":"2020-07-23T14:01:21.243+08:00"},{"id":2932038,"file_name":"bird_1.png","project_id":169741,"asset_id":189061,"created_at":"2020-07-23T14:01:21.243+08:00","updated_at":"2020-07-23T14:01:21.243+08:00"},{"id":2932039,"file_name":"bird_0.png","project_id":169741,"asset_id":189060,"created_at":"2020-07-23T14:01:21.244+08:00","updated_at":"2020-07-23T14:01:21.244+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Screenshot
繁中
简中
English
日本語
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer