{"id":199148,"student_id":10,"content":"from game import *\n\nsky = create_sprite('sky.png') #天空背景圖\nground = create_sprite('ground.png') #跑道\nend = create_sprite('end.png') #終點線\nplayer = create_sprite('p1_0.png', 'p1_1.png') #運動員\narrow = create_sprite('arrow.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, 100)\nplayer.move_to(600, 600)\narrow.move_to(600, 600)\n\nspeed = 0\nstatus = 0\nend.x += 2000\n\nrounds = 0\nscores = [0, 0, 0]\n\ngame.create_sound('bgm.mp3')\n\ndef reset(): \n global i, status, speed, rounds\n status = 0\n speed = 0\n player.move_to(600, 600)\n arrow.move_to(600, 600)\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.2\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 600: status = 3\n \n draw_text('回合1: ' + str(scores[0]) + 'm', 30, 40, 'white', 30)\n draw_text('回合2: ' + str(scores[1]) + 'm', 30, 90, 'white', 30)\n draw_text('回合3: ' + str(scores[2]) + 'm', 30, 140, 'white', 30)\n\n if arrow.x \u003e end.x:\n scores[rounds] = int(arrow.x - end.x) / 100\n \n if status == 3 and key.r: reset()\n \n player.costume_id = int(end.x / 100) % 2\n\ndef speedup():\n global speed\n speed += 1\n\non('keyup', 'right', speedup)\nforever(loop)\n\n","created_at":"2020-10-26T15:39:09.930+08:00","updated_at":"2021-02-01T12:49:15.576+08:00","name":"標槍競賽(預設版)","language":"python","screenshot":{"url":"https://cdn6.koding.school/uploads/project/screenshot/199148/ff2455d12979bec671fd3e0eccf532c3.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":237,"hashid":"5j3s9nepv","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3678457,"file_name":"sky.png","project_id":199148,"asset_id":291415,"created_at":"2020-12-09T11:12:42.850+08:00","updated_at":"2020-12-09T11:12:42.850+08:00"},{"id":3678458,"file_name":"p1_1.png","project_id":199148,"asset_id":291416,"created_at":"2020-12-09T11:12:42.854+08:00","updated_at":"2020-12-09T11:12:42.854+08:00"},{"id":3678459,"file_name":"p1_0.png","project_id":199148,"asset_id":291417,"created_at":"2020-12-09T11:12:42.858+08:00","updated_at":"2020-12-09T11:12:42.858+08:00"},{"id":3678462,"file_name":"arrow.png","project_id":199148,"asset_id":291420,"created_at":"2020-12-09T11:12:42.871+08:00","updated_at":"2020-12-09T11:12:42.871+08:00"},{"id":3719302,"file_name":"end.png","project_id":199148,"asset_id":293309,"created_at":"2020-12-15T10:54:33.452+08:00","updated_at":"2020-12-15T10:54:33.452+08:00"},{"id":3719303,"file_name":"ground.png","project_id":199148,"asset_id":293310,"created_at":"2020-12-15T10:55:16.688+08:00","updated_at":"2020-12-15T10:55:16.688+08:00"},{"id":3719215,"file_name":"dashboard.png","project_id":199148,"asset_id":291652,"created_at":"2020-12-15T10:27:51.516+08:00","updated_at":"2020-12-15T10:27:51.516+08:00"},{"id":3719305,"file_name":"bgm.mp3","project_id":199148,"asset_id":293311,"created_at":"2020-12-15T11:13:30.637+08:00","updated_at":"2020-12-15T11:13:32.972+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦