{"id":46558,"student_id":2008,"content":"// 設定背景圖\nsetBackdrop('bg.jpg');\n\n// 創造角色\nvar ball = createSprite(\"ball.png\");\nvar p1 = createSprite(\"orange.jpg\");\nvar p2 = createSprite(\"blue.jpg\");\n// 初始化位置\np1.x = 631;\np2.x = 10;\nvar whowin\nvar restart = 0\nvar score1 = 0;\nvar score2 = 0;\nvar speed = 5;\nball.direction = 270\n\n\nforever(function() {\n if (restart == 0) {\n\n print(\"press s to start\", 150, 195, \"blue\", 50)\n\n\n if (key.s) {\n restart = 1\n }\n } else {\n if (restart == 1) {\n print(score2, 30, 20, '#157df9', 40);\n print(score1, 580, 20, '#fd7e24', 40);\n ball.stepForward(speed)\n if (ball.x \u003c 0 || ball.x \u003e 640) {\n speed = 5\n if (ball.x \u003c 0) {\n score1 += 1\n ball.direction = 270\n\n }\n if (ball.x \u003e 640) {\n score2 += 1\n ball.direction = 90\n }\n if (score1 == 10 || score2 == 10) {\n if (score1 == 10) {\n whowin = \"p1\"\n restart = 2\n\n } else {\n whowin = \"p2\"\n restart = 2\n }\n\n\n\n }\n\n ball.moveTo(320, 240)\n\n\n\n }\n if (ball.y \u003c 0 || ball.y \u003e 480) {\n ball.direction = ball.direction*-1+180\n }\n if (key.down \u0026\u0026 p1.y \u003c 480) {\n p1.y += 10\n }\n if (key.up \u0026\u0026 p1.y \u003e 0) {\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 if (ball.touched(p1) || ball.touched(p2)) {\n sound.play('BonusCube.mp3')\n ball.direction*=-1\n speed += 0.5\n ball.direction += Math.random()*15\n\n\n } else {\n if (restart == 2) {\n forever(function() {\n print(whowin+\" \"+\"win\", 240, 195, \"red\", 50)\n })\n\n }\n }\n }\n }\n});","created_at":"2018-10-27T10:03:00.510+08:00","updated_at":"2019-09-29T13:20:30.465+08:00","name":"彈力球大賽 副本","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/46558/6a5a4e7511c3e88cd1634b622debdcff.jpg"},"parent_id":8219,"plugin":"\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":80,"hashid":"5j3svnp9","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":828539,"file_name":"blue.jpg","project_id":46558,"asset_id":22110,"created_at":"2018-10-27T10:03:00.521+08:00","updated_at":"2018-10-27T10:03:00.521+08:00"},{"id":828540,"file_name":"orange.jpg","project_id":46558,"asset_id":22111,"created_at":"2018-10-27T10:03:00.524+08:00","updated_at":"2018-10-27T10:03:00.524+08:00"},{"id":828541,"file_name":"ball.png","project_id":46558,"asset_id":22112,"created_at":"2018-10-27T10:03:00.526+08:00","updated_at":"2018-10-27T10:03:00.526+08:00"},{"id":828542,"file_name":"bg.jpg","project_id":46558,"asset_id":22113,"created_at":"2018-10-27T10:03:00.528+08:00","updated_at":"2018-10-27T10:03:00.528+08:00"},{"id":828543,"file_name":"BonusCube.mp3","project_id":46558,"asset_id":22114,"created_at":"2018-10-27T10:03:00.530+08:00","updated_at":"2018-10-27T10:03:00.530+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦