{"id":226845,"student_id":2589,"content":"import game\n\nroad = game.create_sprite('road.jpg') #跑道\nplayer = game.create_sprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png') #玩家\nboard = game.create_sprite('dashboard.png') #分數板子\n\nboard.x = 150\nboard.y = 50\nroad.x += 2000\n\nvx = 0 #移動速度\nvy = 0 #跳躍速度\n\ngame.create_sound('bgm.mp3', True)\n\n#遊戲主迴圈\ndef loop ():\n global vy, vx\n \n road.x -= vx\n if vx \u003e 0: vx -= 0.001\n \n vy += 0.5\n player.y += vy\n if player.y \u003e 450: player.y = 450\n \n if road.x \u003c 600 and player.y \u003e= 450:\n player.costume_id = 3\n game.stop()\n game.create_sound('applause.wav')\n \n if road.x \u003c 600:\n distenace = int(450 - road.x) / 100\n game.draw_text(str(distenace) + 'm', 30, 30, 'white', 60)\n else:\n player.costume_id = int(road.x / 100) % 2\n\n#助跑\ndef speedup ():\n global vx\n if vx \u003c 0: vx = 3\n else: vx += 1\n\n#起跳\ndef jump ():\n global vy\n if player.y == 450: vy = -vx\n player.costume_id = 2\n \n\ngame.forever(loop) #重複不斷執行遊戲主迴圈\ngame.on('keyup', 'right', speedup) #按下右鍵時助跑\ngame.on('keyup', 'up', jump) #按下上鍵時起跳\n","created_at":"2021-02-04T19:03:58.288+08:00","updated_at":"2021-02-04T19:04:35.610+08:00","name":"運動會系列 - 跳遠競賽(解答) ","language":"python","screenshot":{"url":null},"parent_id":210495,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":71,"hashid":"6rps9qznq","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4039892,"file_name":"p_3.png","project_id":226845,"asset_id":291282,"created_at":"2021-02-04T19:03:58.293+08:00","updated_at":"2021-02-04T19:03:58.293+08:00"},{"id":4039893,"file_name":"bgm.mp3","project_id":226845,"asset_id":291283,"created_at":"2021-02-04T19:03:58.299+08:00","updated_at":"2021-02-04T19:03:58.299+08:00"},{"id":4039894,"file_name":"applause.wav","project_id":226845,"asset_id":291284,"created_at":"2021-02-04T19:03:58.300+08:00","updated_at":"2021-02-04T19:03:58.300+08:00"},{"id":4039895,"file_name":"p_2.png","project_id":226845,"asset_id":291285,"created_at":"2021-02-04T19:03:58.301+08:00","updated_at":"2021-02-04T19:03:58.301+08:00"},{"id":4039896,"file_name":"p_1.png","project_id":226845,"asset_id":291286,"created_at":"2021-02-04T19:03:58.302+08:00","updated_at":"2021-02-04T19:03:58.302+08:00"},{"id":4039897,"file_name":"p_0.png","project_id":226845,"asset_id":291287,"created_at":"2021-02-04T19:03:58.303+08:00","updated_at":"2021-02-04T19:03:58.303+08:00"},{"id":4039898,"file_name":"road.jpg","project_id":226845,"asset_id":291288,"created_at":"2021-02-04T19:03:58.304+08:00","updated_at":"2021-02-04T19:03:58.304+08:00"},{"id":4039899,"file_name":"dashboard.png","project_id":226845,"asset_id":291289,"created_at":"2021-02-04T19:03:58.304+08:00","updated_at":"2021-02-04T19:03:58.304+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦