{"id":21906,"student_id":1587,"content":"// 設定背景圖\nsetBackdrop('bg.jpg');\n\n// 創造角色\nvar ball = createSprite(\"ball.png\");\nvar p1 = createSprite(\"orange.jpg\");\nvar p2 = createSprite(\"blue.jpg\");\nball.direction = 100;\nvar thomas = createSprite(\"thomas face1.png\");\n\n// 初始化位置\np1.x = 631;\np2.x = 10;\nthomas.scale = 0.15;\nthomas.x = Math.random() * 640;\nthomas.y = Math.random() * 480;\n\nvar score1 = 0;\nvar score2 = 0;\nvar speed = 5;\nvar next;\nvar c1 = 1000;\nvar c2 = 1000;\nvar ct = 1000;\n\nforever(function() {\n print(score2, 30, 20, '#157df9', 40);\n print(score1, 580, 20, '#fd7e24', 40);\n print(c1, 580, 100, \"red\", 40);\n print(c2, 580, 200, \"red\", 40);\n ball.stepForward(5);\n ct -= 1;\n c1 -= 1;\n c2 -= 1;\n if (c1 \u003c 0) {\n p1.scale = 1;\n }\n if (c2 \u003c 0) {\n p2.scale = 1;\n }\n if (ct \u003c 0) {\n thomas.x = Math.random() * 640;\n thomas.y = Math.random() * 480;\n ct = 1000;\n }\n\n if (ball.touched(thomas)) {\n c = 1000;\n\n if (next == p1) {\n p1.scale = 0.5;\n c1 = 1000;\n }\n\n if (next == p2) {\n p2.scale = 0.5;\n c2 = 1000;\n }\n }\n if (ball.touched(p1)) {\n ball.direction *= -1;\n ball.direction += Math.random() * 15;\n speed += 0.5;\n sound.play(\"BonusCube.mp3\");\n next = p2;\n }\n if (ball.touched(p2)) {\n ball.direction *= -1;\n ball.direction += Math.random() * 15;\n speed += 0.5;\n sound.play(\"BonusCube.mp3\");\n next = p1;\n }\n if (ball.y \u003c 0 || ball.y \u003e 480) {\n ball.direction *= -1;\n ball.direction += 180;\n }\n if (ball.x \u003c 0) {\n score1 ++;\n ball.moveTo(320, 240);\n ball.direction = Math.random() * 180+180;\n speed = 5;\n }\n if (ball.x \u003e 640) {\n score2 ++;\n ball.moveTo(320, 240);\n ball.direction = Math.random() * 180;\n speed = 5;\n }\n if (key.down) {\n p1.y += 10;\n }\n if (key.up) {\n p1.y -= 10;\n }\n if (key.w) {\n p2.y -= 10;\n }\n if (key.s) {\n p2.y += 10;\n }\n});","created_at":"2018-02-09T19:41:42.971+08:00","updated_at":"2019-10-28T14:32:06.400+08:00","name":"彈力球大賽","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/21906/504bb13b16ae00a3b46e53c3e070c757.jpg"},"parent_id":8219,"plugin":"\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":145,"hashid":"p93s4m6r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":422674,"file_name":"blue.jpg","project_id":21906,"asset_id":22110,"created_at":"2018-02-09T19:41:42.980+08:00","updated_at":"2018-02-09T19:41:42.980+08:00"},{"id":422675,"file_name":"orange.jpg","project_id":21906,"asset_id":22111,"created_at":"2018-02-09T19:41:42.983+08:00","updated_at":"2018-02-09T19:41:42.983+08:00"},{"id":422676,"file_name":"ball.png","project_id":21906,"asset_id":22112,"created_at":"2018-02-09T19:41:42.985+08:00","updated_at":"2018-02-09T19:41:42.985+08:00"},{"id":422677,"file_name":"bg.jpg","project_id":21906,"asset_id":22113,"created_at":"2018-02-09T19:41:42.993+08:00","updated_at":"2018-02-09T19:41:42.993+08:00"},{"id":422678,"file_name":"BonusCube.mp3","project_id":21906,"asset_id":22114,"created_at":"2018-02-09T19:41:42.999+08:00","updated_at":"2018-02-09T19:41:42.999+08:00"},{"id":432613,"file_name":"thomas face1.png","project_id":21906,"asset_id":52190,"created_at":"2018-02-23T19:10:24.745+08:00","updated_at":"2018-02-23T19:10:24.745+08:00"},{"id":432614,"file_name":"thomas face1.png","project_id":21906,"asset_id":52190,"created_at":"2018-02-23T19:19:10.392+08:00","updated_at":"2018-02-23T19:19:10.392+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦