{"id":11443,"student_id":1575,"content":"// 設定背景圖\nsetBackdrop('bg.jpg');\n\n// 創造角色\nvar ball = createSprite(\"ball.png\");\nvar p1 = createSprite(\"orange.jpg\");\nvar p2 = createSprite(\"blue.jpg\");\nvar ball2 =createSprite(\"ball.png\")\nvar ball3 =createSprite(\"ball.png\")\n// 初始化位置\np1.x = 631;\np2.x = 10;\nball.direction=60\nvar score1 = 0;\nvar score2 = 0;\nvar speed = 5;\nvar c=0;\nvar move=false\nball2.opacity=0;\nball3.opacity=0;\nforever(function() {\n if(c\u003e2){\n ball2.opacity=1\n if(ball2.x\u003c1){\nscore1+=1\nball2.x=320\nball2.y=240\nball2.direction=270\nspeed=5\n\n }\n if(ball2.x\u003e639){\n score2+=1\n ball2.x=320\n ball2.y=240\n ball2.direction=90\n speed=5}\n ball2.opacity=1\n if(ball2.y\u003c0||ball2.y\u003e460){\n ball2.direction=-ball2.direction+180+Math.random()*15\n speed+=0.5\n }\n if(ball2.touched(p1)||ball2.touched(p2)){\n ball2.direction=-ball2.direction+Math.random()*30\n speed+=0.5\n sound.play(\"BonusCube.mp3\");\n }\n ball2.stepForward(speed)\n if(ball2.x\u003c0|| ball2.x\u003e640){\n ball2.direction=-ball2.direction+Math.random()*15\nspeed+=0.5\nball3.opacity=1\n if(ball3.x\u003c1){\nscore1+=1\nball3.x=320\nball3.y=240\nball3.direction=270\nspeed=5\n\n }\n if(ball3.x\u003e639){\n score2+=1\n ball3.x=320\n ball3.y=240\n ball3.direction=90\n speed=5}\n ball2.opacity=1\n if(ball3.y\u003c0||ball3.y\u003e460){\n ball3.direction=-ball3.direction+180+Math.random()*15\n speed+=0.5\n }\n if(ball3.touched(p1)||ball3.touched(p2)){\n ball3.direction=-ball3.direction+Math.random()*30\n speed+=0.5\n sound.play(\"BonusCube.mp3\");\n }\n ball3.stepForward(speed)\n if(ball3.x\u003c0|| ball3.x\u003e640){\n ball3.direction=-ball3.direction+Math.random()*15\nspeed+=0.5\n }\n }}\n if(score1\u003e9){\n print(\"p1 wins\",240,320,\"red\",100)\n stop();\n }\n if(score2\u003e9){\n print(\"p2 wins\",240,320,\"red\",100)\n stop();\n }\n if(key.down){\n p1.y=p1.y+10;\n }\n if(key.up){\n p1.y=p1.y-10;\n }\n if(key.w){\n p2.y=p2.y-10;\n }\n if(key.s){\n p2.y=p2.y+10;\n }\n ball.stepForward(speed)\n if(ball.x\u003c0|| ball.x\u003e640){\n ball.direction=-ball.direction+Math.random()*15\nspeed+=0.5\n }\n if(ball.y\u003c0||ball.y\u003e460){\n ball.direction=-ball.direction+180+Math.random()*15\n speed+=0.5\n }\n print(score2, 30, 20, '#157df9', 40);\n print(score1, 580, 20, '#fd7e24', 40);\n print(c)\n if(ball.touched(p1)||ball.touched(p2)){\n ball.direction=-ball.direction+Math.random()*30\n speed+=0.5\n sound.play(\"BonusCube.mp3\");\n }\n if(ball.x\u003c1){\nscore1+=1\nball.x=320\nball.y=240\nball.direction=270\nspeed=5\nc=0\n }\n if(ball.x\u003e639){\n score2+=1\n ball.x=320\n ball.y=240\n ball.direction=90\n speed=5\n c+=1\n \n \n }\n if(c\u003e2){\n if (key.b){\n move=true\n \n }\n }\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-07-21T12:33:05.122+08:00","name":"彈力球大賽","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/11443/bbf348fbb7494dabb44bf2169aa108ba.jpg"},"parent_id":8219,"plugin":"\n","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":131,"hashid":"zpesj899","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":250952,"file_name":"blue.jpg","project_id":11443,"asset_id":22110,"created_at":"2017-09-16T15:53:17.765+08:00","updated_at":"2017-09-16T15:53:17.765+08:00"},{"id":250953,"file_name":"orange.jpg","project_id":11443,"asset_id":22111,"created_at":"2017-09-16T15:53:17.767+08:00","updated_at":"2017-09-16T15:53:17.767+08:00"},{"id":250954,"file_name":"ball.png","project_id":11443,"asset_id":22112,"created_at":"2017-09-16T15:53:17.769+08:00","updated_at":"2017-09-16T15:53:17.769+08:00"},{"id":250955,"file_name":"bg.jpg","project_id":11443,"asset_id":22113,"created_at":"2017-09-16T15:53:17.770+08:00","updated_at":"2017-09-16T15:53:17.770+08:00"},{"id":250956,"file_name":"BonusCube.mp3","project_id":11443,"asset_id":22114,"created_at":"2017-09-16T15:53:17.772+08:00","updated_at":"2017-09-16T15:53:17.772+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
繁中
简中
English
日本語
1:1:1
1:1
全寬
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦