{"id":10236,"student_id":1404,"content":"var score1 = 0;\nvar score2 = 0;\nvar speed = 5;\n\n\n\n\nvar ran = Math.random() * 2;\nif (ran \u003c 1) {\n ball.direction = Math.random()*90 + 225;//發給左邊\n} else {\n ball.direction = Math.random()*90 + 45;//發給右邊\n}\n\nforever(function() {\n \n ball.stepForward(speed);\n\n // 球碰到邊界\n touchBorder();\n\n // 按鍵移動\n controlPlayer();\n\n // 碰到擋板反彈\n touchPlayer();\n\n print(score1, 580, 20, '#fd7e24', 40);\n print(score2, 30, 20, '#157df9', 40);\n});\n\nfunction touchBorder() {\n if (ball.x \u003e 640 || ball.x \u003c 0) {\n if(ball.x \u003e 640){\n score2 += 1;\n ball.direction = Math.random()*90 + 45;\n }else{\n score1 += 1;\n ball.direction = Math.random()*90 + 225;\n }\n ball.x = 320;\n ball.y = 240;\n }\n if (ball.y \u003c 0 || ball.y \u003e 480){\n ball.direction = -ball.direction + 180;\n }\n}\n\n\n\n\n\nfunction touchBorder() {\n if (ball.x \u003e 640) {\n score2 += 1;\n ball.x = 320;\n ball.y = 240;\n ball.direction = Math.random() * 90 + 45;\n speed = 5;\n }\n if (ball.x \u003c 0) {\n score1 += 1;\n ball.x = 320;\n ball.y = 240;\n ball.direction = Math.random() * 90 + 225;\n speed = 5;\n }\n\n if (ball.y \u003c 0 || ball.y \u003e 480) {\n ball.direction = -ball.direction + 180;\n }\n}\n\nfunction controlPlayer() {\n if (key.up \u0026\u0026 p1.y\u003e0) {\n p1.y -= 10;\n }\n if (key.down \u0026\u0026 p1.y\u003c480) {\n p1.y += 10;\n }\n if (key.w \u0026\u0026 p2.y \u003e 0) {\n p2.y -= 10;\n }\n if (key.s \u0026\u0026 p2.y \u003c 480) {\n p2.y += 10;\n }\n}\n\nfunction touchPlayer() {\n //碰到擋板反彈\n}\n\n\n\n\n\n","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-10-11T12:43:12.224+08:00","name":"彈力球大賽","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/10236/d7c9c5f42e526d00868847a5c42565f1.jpg"},"parent_id":8219,"plugin":"setBackdrop('bg.jpg');\nvar ball = createSprite(\"ball.png\");\nvar p2 = createSprite({\n costumes: \"blue.jpg\",\n x: 10,\n y: 250\n});\nvar p1 = createSprite({\n costumes: \"orange.jpg\",\n x: 631,\n y: 250\n});\n// =================================//\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":95,"hashid":"5j3s9386","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":226827,"file_name":"blue.jpg","project_id":10236,"asset_id":22110,"created_at":"2017-08-26T20:27:24.935+08:00","updated_at":"2017-08-26T20:27:24.935+08:00"},{"id":226828,"file_name":"orange.jpg","project_id":10236,"asset_id":22111,"created_at":"2017-08-26T20:27:24.938+08:00","updated_at":"2017-08-26T20:27:24.938+08:00"},{"id":226829,"file_name":"ball.png","project_id":10236,"asset_id":22112,"created_at":"2017-08-26T20:27:24.941+08:00","updated_at":"2017-08-26T20:27:24.941+08:00"},{"id":226830,"file_name":"bg.jpg","project_id":10236,"asset_id":22113,"created_at":"2017-08-26T20:27:24.944+08:00","updated_at":"2017-08-26T20:27:24.944+08:00"},{"id":226831,"file_name":"BonusCube.mp3","project_id":10236,"asset_id":22114,"created_at":"2017-08-26T20:27:24.946+08:00","updated_at":"2017-08-26T20:27:24.946+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦