{"id":114851,"student_id":3302,"content":"// 設定背景圖\nsetBackdrop('bg.jpg');\n\n// 創造角色\nvar ball = createSprite(\"ball.png\");\nvar p1 = createSprite(\"orange.jpg\");\nvar p2 = createSprite(\"blue.jpg\");\nvar lives = createSprite(\"love-broken-love-broken-heart-brokenlovepoems.jpg\");\nvar lives1 = createSprite(\"1200px-Heart_corazón.svg.png\");\n// 初始化位置\np1.x = 631;\np2.x = 10;\n\nvar score1 = 5;\nvar score2 = 5;\nvar speed = 3;\nvar livesSpeed = 4;\nvar lives1Speed = 4;\nvar p1lives = 3;\nvar p2lives = 3;\nvar level = 1;\n\nball.direction = Math.random()*359+1;\nlives.direction = Math.random()*359+1;\nlives1.direction = Math.random()*359+1;\nlives. scale = 0.05;\nlives1. scale = 0.02\n\nforever(function() {\n ball.stepForward(speed);\n lives.stepForward(livesSpeed);\n lives1.stepForward(lives1Speed);\n touchBorder();\n touchPlayer();\n controlPlayer();\n pong();\n\n\n print(\"score:\"+score2, 30, 20, '#157df9', 20);\n print(\"score:\"+score1, 540, 20, '#fd7e24', 20);\n print(\"lives:\"+p1lives, 30, 60, '#157df9', 20);\n print(\"lives:\"+p2lives, 540, 60, '#fd7e24', 20);\n});\nfunction touchBorder() {\n if (ball.x \u003e 640) {\n score2 += 5;\n score1 -= 3;\n ball.x = 320;\n ball.y = 240;\n ball.direction = Math.random()*359+1;\n speed = 3;\n p2lives -= 1;\n }\n\n if (ball.x \u003c 0) {\n score1 += 5;\n score2 -= 3;\n ball.x = 320;\n ball.y = 240;\n ball.direction = Math.random()*359+1;\n speed = 3;\n p1lives -= 1;\n }\n if (ball.y \u003e 480 || ball.y \u003c 0) {\n ball.direction=- ball. direction+180;\n }\n\n\n\n if (lives.x \u003e 640) {\n lives.x = 320;\n lives.y = 240;\n lives.direction = Math.random()*359+1;\n }\n\n if (lives.x \u003c 0) {\n lives.x = 320;\n lives.y = 240;\n lives.direction = Math.random()*359+1;\n }\n if (lives.y \u003e 480 || lives.y \u003c 0) {\n lives.direction=- lives. direction+180;\n }\n\n\n\n if (lives1.x \u003e 640) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n }\n if (lives1.x \u003c 0) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n }\n if (lives1.y \u003e 480 || lives1.y \u003c 0) {\n lives1.direction=- lives1. direction+180;\n }\n}\nfunction controlPlayer() {\n if (key.down) {\n p1.y += 10;\n }\n if (key.up) {\n p1.y -= 10;\n }\n if (key.s) {\n p2.y += 10;\n }\n if (key.z) {\n p2.y -= 10;\n }\n \n}\nfunction touchPlayer() {\n if (ball.touched(p1)) {\n ball.direction = -ball.direction+Math.random()*15;\n speed += 1;\n score1 += 2;\n }\n if (ball.touched(p2)) {\n ball.direction = -ball.direction+Math.random()*15;\n speed += 1;\n score2 += 2;\n }\n\n\n if (lives.touched(p1)) {\n lives.x = 320;\n lives.y = 240;\n lives.direction = Math.random()*359+1;\n p2lives -= 1;\n score1 -= 3;\n }\n if (lives.touched(p2)) {\n lives.x = 320;\n lives.y = 240;\n lives.direction = Math.random()*359+1;\n p1lives -= 1;\n score2 -= 3;\n }\n\n\n if (lives1.touched(p1) \u0026\u0026 p2lives \u003c 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n p2lives += 1;;\n }\n if (lives1.touched(p2) \u0026\u0026 p1lives \u003c 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n p1lives += 1;\n }\n if (lives1.touched(p2) \u0026\u0026 p2lives \u003c 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n score2 += 2;\n }\n if (lives1.touched(p1) \u0026\u0026 p1lives \u003c 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n score2 += 2;\n }\n if (lives1.touched(p2) \u0026\u0026 p1lives === 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n score2 += 3;\n }\n if (lives1.touched(p1) \u0026\u0026 p2lives === 3) {\n lives1.x = 320;\n lives1.y = 240;\n lives1.direction = Math.random()*359+1;\n score1 += 3;\n }\n\n\n\n}\nfunction pong (){\n if (ball.touched(lives1)||ball.touched(lives)) {\n ball.direction = Math.random()*359+1;\n speed -= 1;\n }\n if (lives1.touched(lives)||lives1.touched(ball)) {\n ball.direction = Math.random()*359+1;\n }\n if (lives.touched(ball)||lives.touched(lives1)) {\n ball.direction = Math.random()*359+1;\n }\n}\nforever(function() {\n /* Do this every tick */\n if (p1.y \u003c 60) {\n p1.y += 10;\n }\n if (p2.y \u003c 60) {\n p2.y += 10;\n }\n if (p1.y \u003e 420) {\n p1.y -= 10;\n }\n if (p2.y \u003e 420) {\n p2.y -= 10;\n }\n})\nforever(function() {\n if (p1lives === 0 || p2lives === 0 || score1 \u003c 0 || score2 \u003c 0) {\n stop();\n }\n})","created_at":"2019-12-18T19:53:39.512+08:00","updated_at":"2020-01-25T01:26:29.223+08:00","name":"彈力球大賽 副本","language":"javascript","screenshot":{"url":"https://cdn4.koding.school/uploads/project/screenshot/114851/c910dea4ef86a48bf6f4ad16d9e3eb25.jpg"},"parent_id":8219,"plugin":"\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":153,"hashid":"5j3sp463","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1963467,"file_name":"blue.jpg","project_id":114851,"asset_id":22110,"created_at":"2019-12-18T19:53:39.520+08:00","updated_at":"2019-12-18T19:53:39.520+08:00"},{"id":1963468,"file_name":"orange.jpg","project_id":114851,"asset_id":22111,"created_at":"2019-12-18T19:53:39.522+08:00","updated_at":"2019-12-18T19:53:39.522+08:00"},{"id":1963469,"file_name":"ball.png","project_id":114851,"asset_id":22112,"created_at":"2019-12-18T19:53:39.523+08:00","updated_at":"2019-12-18T19:53:39.523+08:00"},{"id":1963470,"file_name":"bg.jpg","project_id":114851,"asset_id":22113,"created_at":"2019-12-18T19:53:39.525+08:00","updated_at":"2019-12-18T19:53:39.525+08:00"},{"id":1963471,"file_name":"BonusCube.mp3","project_id":114851,"asset_id":22114,"created_at":"2019-12-18T19:53:39.527+08:00","updated_at":"2019-12-18T19:53:39.527+08:00"},{"id":1993069,"file_name":"1200px-Heart_corazón.svg.png","project_id":114851,"asset_id":174471,"created_at":"2019-12-25T21:26:03.140+08:00","updated_at":"2019-12-25T21:26:03.140+08:00"},{"id":1993070,"file_name":"love-broken-love-broken-heart-brokenlovepoems.jpg","project_id":114851,"asset_id":174472,"created_at":"2019-12-25T21:55:06.843+08:00","updated_at":"2019-12-25T21:55:06.843+08:00"},{"id":1993068,"file_name":"3 hearts.png","project_id":114851,"asset_id":174470,"created_at":"2019-12-25T21:23:31.391+08:00","updated_at":"2019-12-25T21:23:31.391+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦