{"id":226848,"student_id":2589,"content":"from game import *\n\nsky = create_sprite('sky.png') #天空背景圖\nground = create_sprite('ground.png') #跑道\nend = create_sprite('end.png') #終點線\narrow = create_sprite('arrow.png') #標槍\nplayer = create_sprite('p1_0.png', 'p1_1.png') #運動員\nboard = create_sprite('dashboard.png') #計分板\n\n#角色圖片不隨 direction 屬性旋轉\nsky.rotation_style = 'fixed'\nground.rotation_style = 'fixed'\nplayer.rotation_style = 'fixed'\nend.rotation_style = 'fixed'\n\nboard.move_to(150, 50)\n\nspeed = 0\nstatus = 0\nend.x += 2000\n\nrounds = 0\nscores = [0, 0, 0]\n\ndef reset(): \n global i, status, speed\n status = 0\n speed = 0\n player.move_to(600, 450)\n arrow.move_to(600, 450)\n end.move_to(600 + 2000, 450)\n arrow.direction = 90\n rounds += 1\n\n\ndef loop():\n global status, speed\n \n if sky.x \u003c 0: sky.x += 1200\n if sky.y \u003c 0: sky.y += 900\n if sky.y \u003e 900: sky.y -= 900\n if ground.x \u003c 0: ground.x += 1200\n \n if status == 0 or status == 2:\n sky.direction = arrow.direction + 180\n sky.step_forward(speed)\n ground.direction = arrow.direction + 180\n ground.step_forward(speed)\n end.direction = arrow.direction + 180\n end.step_forward(speed)\n \n if key.up and status != 2:\n status = 1\n arrow.direction -= 1\n speed -= 0.3\n \n if status == 1 and key.up == False:\n status = 2\n \n if status == 2:\n player.direction = arrow.direction + 180\n player.step_forward(speed)\n arrow.direction += 0.2\n \n if player.x \u003e end.x or player.y \u003c 450: status = 3\n \n draw_text('回合一 ' + str(scores[0]) + 'm', 30, 30, 'white', 50)\n draw_text('回合二 ' + str(scores[1]) + 'm', 30, 80, 'white', 50)\n draw_text('回合三 ' + str(scores[2]) + 'm', 30, 130, 'white', 50)\n\n scores[rounds] = int(arrow.x - end.x) / 100\n if status == 3 and key.r: reset()\n \n player.costume_id = int(scores[rounds]) % 2\n \n\ndef speedup():\n global speed\n speed += 1\n\non('keyup', 'right', speedup)\nforever(loop)","created_at":"2021-02-04T19:09:55.152+08:00","updated_at":"2021-02-04T19:10:28.381+08:00","name":"標槍競賽(解答)","language":"python","screenshot":{"url":null},"parent_id":212512,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":70,"hashid":"wdks4wgz3","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4039929,"file_name":"bgm.mp3","project_id":226848,"asset_id":293865,"created_at":"2021-02-04T19:09:55.170+08:00","updated_at":"2021-02-04T19:09:55.170+08:00"},{"id":4039930,"file_name":"ground.png","project_id":226848,"asset_id":293866,"created_at":"2021-02-04T19:09:55.171+08:00","updated_at":"2021-02-04T19:09:55.171+08:00"},{"id":4039931,"file_name":"end.png","project_id":226848,"asset_id":293867,"created_at":"2021-02-04T19:09:55.172+08:00","updated_at":"2021-02-04T19:09:55.172+08:00"},{"id":4039932,"file_name":"dashboard.png","project_id":226848,"asset_id":293868,"created_at":"2021-02-04T19:09:55.173+08:00","updated_at":"2021-02-04T19:09:55.173+08:00"},{"id":4039933,"file_name":"arrow.png","project_id":226848,"asset_id":293869,"created_at":"2021-02-04T19:09:55.174+08:00","updated_at":"2021-02-04T19:09:55.174+08:00"},{"id":4039934,"file_name":"p1_0.png","project_id":226848,"asset_id":293870,"created_at":"2021-02-04T19:09:55.175+08:00","updated_at":"2021-02-04T19:09:55.175+08:00"},{"id":4039935,"file_name":"p1_1.png","project_id":226848,"asset_id":293871,"created_at":"2021-02-04T19:09:55.176+08:00","updated_at":"2021-02-04T19:09:55.176+08:00"},{"id":4039936,"file_name":"sky.png","project_id":226848,"asset_id":293872,"created_at":"2021-02-04T19:09:55.177+08:00","updated_at":"2021-02-04T19:09:55.177+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦