{"id":193779,"student_id":10,"content":"import game #載入遊戲套件\nimport random #載入隨機數套件\n\nground = game.create_sprite('ground.png') #道路街景\ndino = game.create_sprite('dino_0.png', 'dino_1.png') #恐龍\nb1 = game.create_sprite('0.png', '1.png', '2.png', '3.png', '4.png') #1號障礙物\nb2 = game.create_sprite('0.png', '1.png', '2.png', '3.png', '4.png') #2號障礙物\nb3 = game.create_sprite('0.png', '1.png', '2.png', '3.png', '4.png') #3號障礙物\nboard = game.create_sprite('board.png') #計分版\nhint = game.create_sprite('hint.png') #遊戲說明圖\n\ndino.y = 600\nb1.y = 600\nb2.y = 600\nb3.y = 600\n\ndino.x = 300\nb1.x = 2000\nb2.x = 2500\nb3.x = 3000\n\nvy = 0 #垂直速度\nvx = 10 #水平速度\nscore = 0 #分數\n\n\n#遊戲主迴圈\ndef loop():\n global vx, vy, score #存取函式外變數\n \n if hint.hidden == True:\n ground.x -= vx\n b1.x -= vx * 1.3\n b2.x -= vx * 1.3\n b3.x -= vx * 1.3\n \n if ground.x \u003c 0:\n ground.x += 3000\n \n if b1.x \u003c -100:\n b1.x = b3.x + random.randrange(400, 1000) * vx / 10\n b1.costume_id = random.randrange(5)\n \n if b2.x \u003c -100:\n b2.x = b1.x + random.randrange(400, 1000) * vx / 10\n b2.costume_id = random.randrange(5)\n \n if b3.x \u003c -100:\n b3.x = b2.x + random.randrange(400, 1000) * vx / 10\n b3.costume_id = random.randrange(5)\n \n dino.y += vy #根據 vy 改變恐龍垂直y座標\n vy += 2 #加速度\n if game.key.space and dino.y \u003e= 600:\n vy = -30 #向上跳躍\n \n if dino.y \u003e 600: dino.y = 600 #恐龍墜落不超過道路\n \n #當恐龍撞到任一障礙物時\n if dino.touched(b1) or dino.touched(b2) or dino.touched(b3):\n hint.hidden = False\n \n if hint.hidden == True:\n score += 1/6\n game.draw_text(int(score), 30, 30, 'black', 60)\n \n if hint.hidden == True:\n dino.costume_id = int(score) % 2\n \n if score % 300 \u003c 150:\n game.set_backdrop('sky_light.png')\n else:\n game.set_backdrop('sky_dark.png')\n \n vx = 10 + score / 100\n \n if game.key.enter and hint.hidden == False:\n hint.hidden = True\n b1.x = 2000\n b2.x = 2500\n b3.x = 3000\n score = 0\n\n\ngame.forever(loop) #重複不斷執行\n\n\n\n","created_at":"2020-09-23T11:07:59.133+08:00","updated_at":"2021-02-02T11:15:49.058+08:00","name":"小恐龍大爆走(預設版)","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/193779/ab550fa6029a553c57433d4e02a895cc.jpg"},"parent_id":193778,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":249,"hashid":"meysr3ne","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3315277,"file_name":"jump.ogg","project_id":193779,"asset_id":265664,"created_at":"2020-09-23T11:09:17.764+08:00","updated_at":"2020-09-23T11:09:17.764+08:00"},{"id":3315278,"file_name":"milestone.mp3","project_id":193779,"asset_id":265665,"created_at":"2020-09-23T11:09:17.768+08:00","updated_at":"2020-09-23T11:09:17.768+08:00"},{"id":3315279,"file_name":"bgm.mp3","project_id":193779,"asset_id":265666,"created_at":"2020-09-23T11:09:17.851+08:00","updated_at":"2020-09-23T11:09:17.851+08:00"},{"id":3315280,"file_name":"0.png","project_id":193779,"asset_id":265667,"created_at":"2020-09-23T11:09:17.856+08:00","updated_at":"2020-09-23T11:09:17.856+08:00"},{"id":3315281,"file_name":"2.png","project_id":193779,"asset_id":265668,"created_at":"2020-09-23T11:09:17.865+08:00","updated_at":"2020-09-23T11:09:17.865+08:00"},{"id":3315282,"file_name":"3.png","project_id":193779,"asset_id":265669,"created_at":"2020-09-23T11:09:17.870+08:00","updated_at":"2020-09-23T11:09:17.870+08:00"},{"id":3315283,"file_name":"4.png","project_id":193779,"asset_id":265670,"created_at":"2020-09-23T11:09:17.874+08:00","updated_at":"2020-09-23T11:09:17.874+08:00"},{"id":3315284,"file_name":"sky_dark.png","project_id":193779,"asset_id":265671,"created_at":"2020-09-23T11:09:17.878+08:00","updated_at":"2020-09-23T11:09:17.878+08:00"},{"id":3315285,"file_name":"board.png","project_id":193779,"asset_id":265672,"created_at":"2020-09-23T11:09:17.882+08:00","updated_at":"2020-09-23T11:09:17.882+08:00"},{"id":3315286,"file_name":"dino_0.png","project_id":193779,"asset_id":265673,"created_at":"2020-09-23T11:09:17.887+08:00","updated_at":"2020-09-23T11:09:17.887+08:00"},{"id":3315287,"file_name":"dino_1.png","project_id":193779,"asset_id":265674,"created_at":"2020-09-23T11:09:17.891+08:00","updated_at":"2020-09-23T11:09:17.891+08:00"},{"id":3315288,"file_name":"hint.png","project_id":193779,"asset_id":265675,"created_at":"2020-09-23T11:09:17.895+08:00","updated_at":"2020-09-23T11:09:17.895+08:00"},{"id":3315289,"file_name":"bg.png","project_id":193779,"asset_id":265676,"created_at":"2020-09-23T11:09:17.900+08:00","updated_at":"2020-09-23T11:09:17.900+08:00"},{"id":3315290,"file_name":"sky_light.png","project_id":193779,"asset_id":265677,"created_at":"2020-09-23T11:09:17.904+08:00","updated_at":"2020-09-23T11:09:17.904+08:00"},{"id":3315291,"file_name":"ground.png","project_id":193779,"asset_id":265678,"created_at":"2020-09-23T11:09:17.910+08:00","updated_at":"2020-09-23T11:09:17.910+08:00"},{"id":3315292,"file_name":"1.png","project_id":193779,"asset_id":265679,"created_at":"2020-09-23T11:09:17.914+08:00","updated_at":"2020-09-23T11:09:17.914+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦