{"id":245285,"student_id":10,"content":"setBackdrop(\"bg.jpg\"); //設定背景圖\ncreateSprite(\"board.png\"); //計分板角色\nvar p1 = createSprite(\"otter_0.png\", \"otter_1.png\", \"otter_2.png\", \"otter_3.png\", \"otter_4.png\"); //左邊玩家\nvar p2 = createSprite(\"koding_0.png\", \"koding_1.png\", \"koding_2.png\", \"koding_3.png\", \"koding_4.png\"); //右邊玩家\nvar obj = createSprite(\"twig.png\", \"shell.png\"); //武器\nvar hint = createSprite(\"tutorial.jpg\"); //開始畫面\n\np1.x = 200;\np1.y = 700;\np2.x = 1000;\np2.y = 700;\n\n//將武器移動到左邊玩家\nobj.x = p1.x;\nobj.y = p1.y;\nobj.hidden = true;\n// hint.hidden = true;\n\nvar p1_hp = 400; //左邊玩家血量\nvar p2_hp = 400; //右邊玩家血量\nvar p1_power = 0; //左邊玩家蓄力\nvar p2_power = 0; //右邊玩家蓄力\nvar vx = 0; //武器水平移動速度\nvar vy = 0; //武器垂直移動速度\nvar wind = 0; //風速\nvar status = 0; //遊戲狀態\n\non(\"mousedown\", mousedown); //滑鼠點下時執行 mousedown 函式\non(\"mouseup\", mouseup); //滑鼠放開時執行 mouseup 函式\n\ncreateSound('bgm.mp3');\n\nfunction mousedown () {\n if (status == 1) {\n status = 2;\n }\n if (status == 4) {\n status = 5;\n }\n}\n\nfunction mouseup () {\n if (status == 2) {\n status = 3;\n vy = -p1_power;\n vx = p1_power;\n }\n if (status == 5) {\n status = 6;\n vy = -p2_power;\n vx = -p2_power;\n }\n}\n\n//遊戲主迴圈\nfunction loop () {\n\n if (status == 2) {\n p1.costumeId = 1;\n }\n if (status == 3) {\n p1.costumeId = 2;\n }\n if (status == 2 \u0026\u0026 p1_power \u003c 40) {\n p1_power += 1;\n }\n \n if (status == 5) {\n p2.costumeId = 1;\n }\n if (status == 6) {\n p2.costumeId = 2;\n }\n if (status == 5 \u0026\u0026 p2_power \u003c 40) {\n p2_power += 1;\n }\n\n if (status == 3 || status == 6)\n vy += 1;\n obj.x += vx;\n obj.y += vy;\n }\n}\n\nfunction reset () {\n \n}\n\nfunction checkGameOver () {\n \n}\n\nfunction drawBars() {\n pen.fillColor = \"red\";\n pen.drawRect(500, 40, -p1_hp, 20);\n pen.drawRect(700, 40, +p2_hp, 20);\n pen.fillColor = \"blue\";\n pen.drawRect(580 + wind * 10, 120, 40, 20);\n \n if (status == 1 || status == 2) {\n pen.fillColor = \"white\";\n pen.drawRect(50, 600, 40, 200);\n pen.fillColor = \"red\";\n pen.drawRect(50, 800, 40, -p1_power * 5);\n }\n if (status == 4 || status == 5) {\n pen.fillColor = \"white\";\n pen.drawRect(1110, 600, 40, 200);\n pen.fillColor = \"red\";\n pen.drawRect(1110, 800, 40, -p2_power * 5);\n }\n}\n\n//重複不斷執行...\nforever(function(){\n loop();\n checkGameOver();\n drawBars();\n});","created_at":"2021-04-23T09:56:20.427+08:00","updated_at":"2021-04-23T10:32:03.354+08:00","name":"獺獺大戰_除錯範例_2","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/245285/d1df25b2738683732bd80fb77933492e.jpg"},"parent_id":208678,"plugin":"Game.set({width: 1200, height: 900});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":190,"hashid":"36ysm53j5","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4565127,"file_name":"bgm.mp3","project_id":245285,"asset_id":289605,"created_at":"2021-04-23T09:56:20.433+08:00","updated_at":"2021-04-23T09:56:20.433+08:00"},{"id":4565128,"file_name":"board.png","project_id":245285,"asset_id":289606,"created_at":"2021-04-23T09:56:20.434+08:00","updated_at":"2021-04-23T09:56:20.434+08:00"},{"id":4565129,"file_name":"throw.wav","project_id":245285,"asset_id":289607,"created_at":"2021-04-23T09:56:20.435+08:00","updated_at":"2021-04-23T09:56:20.435+08:00"},{"id":4565130,"file_name":"twig.png","project_id":245285,"asset_id":289608,"created_at":"2021-04-23T09:56:20.436+08:00","updated_at":"2021-04-23T09:56:20.436+08:00"},{"id":4565131,"file_name":"otter_4.png","project_id":245285,"asset_id":289609,"created_at":"2021-04-23T09:56:20.437+08:00","updated_at":"2021-04-23T09:56:20.437+08:00"},{"id":4565132,"file_name":"otter_3.png","project_id":245285,"asset_id":289610,"created_at":"2021-04-23T09:56:20.437+08:00","updated_at":"2021-04-23T09:56:20.437+08:00"},{"id":4565133,"file_name":"otter_2.png","project_id":245285,"asset_id":289611,"created_at":"2021-04-23T09:56:20.438+08:00","updated_at":"2021-04-23T09:56:20.438+08:00"},{"id":4565134,"file_name":"otter_1.png","project_id":245285,"asset_id":289612,"created_at":"2021-04-23T09:56:20.439+08:00","updated_at":"2021-04-23T09:56:20.439+08:00"},{"id":4565135,"file_name":"otter_0.png","project_id":245285,"asset_id":289613,"created_at":"2021-04-23T09:56:20.440+08:00","updated_at":"2021-04-23T09:56:20.440+08:00"},{"id":4565136,"file_name":"koding_4.png","project_id":245285,"asset_id":289614,"created_at":"2021-04-23T09:56:20.441+08:00","updated_at":"2021-04-23T09:56:20.441+08:00"},{"id":4565137,"file_name":"koding_3.png","project_id":245285,"asset_id":289615,"created_at":"2021-04-23T09:56:20.442+08:00","updated_at":"2021-04-23T09:56:20.442+08:00"},{"id":4565138,"file_name":"koding_2.png","project_id":245285,"asset_id":289616,"created_at":"2021-04-23T09:56:20.442+08:00","updated_at":"2021-04-23T09:56:20.442+08:00"},{"id":4565139,"file_name":"koding_1.png","project_id":245285,"asset_id":289617,"created_at":"2021-04-23T09:56:20.443+08:00","updated_at":"2021-04-23T09:56:20.443+08:00"},{"id":4565140,"file_name":"koding_0.png","project_id":245285,"asset_id":289618,"created_at":"2021-04-23T09:56:20.444+08:00","updated_at":"2021-04-23T09:56:20.444+08:00"},{"id":4565141,"file_name":"hit.wav","project_id":245285,"asset_id":289619,"created_at":"2021-04-23T09:56:20.445+08:00","updated_at":"2021-04-23T09:56:20.445+08:00"},{"id":4565142,"file_name":"tutorial.jpg","project_id":245285,"asset_id":289620,"created_at":"2021-04-23T09:56:20.446+08:00","updated_at":"2021-04-23T09:56:20.446+08:00"},{"id":4565143,"file_name":"shell.png","project_id":245285,"asset_id":289621,"created_at":"2021-04-23T09:56:20.447+08:00","updated_at":"2021-04-23T09:56:20.447+08:00"},{"id":4565144,"file_name":"pk.png","project_id":245285,"asset_id":289622,"created_at":"2021-04-23T09:56:20.448+08:00","updated_at":"2021-04-23T09:56:20.448+08:00"},{"id":4565145,"file_name":"bg.jpg","project_id":245285,"asset_id":289623,"created_at":"2021-04-23T09:56:20.449+08:00","updated_at":"2021-04-23T09:56:20.449+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦