{"id":328959,"student_id":10,"content":"setBackdrop('bg.png');\nlet level = createSprite('L0.png', 'L1.png', 'L2.png', 'L3.png', 'L4.png', 'L5.png', 'L6.png', 'L7.png', 'L8.png', 'L9.png', 'L10.png', 'L11.png', 'L12.png'); //開始\nlet ranks = createSprite('r0.png', 'r1.png', 'r2.png', 'r3.png', 'r4.png', 'r5.png', 'r6.png', 'r7.png', 'r8.png', 'r9.png', 'r10.png', 'r11.png', 'r12.png'); //官階\nlet ball = createSprite('ball.png'); //玩家雪球\nlet player = createSprite('r_0.png', 'r_1.png', 'r_2.png'); //玩家\n\nlet enemies = []; //存放敵人角色\nlet balls = []; //存放敵人雪球\nlet life = 3; //玩家血量\n\nlevel.layer = 1000;\nranks.layer = 1000;\nplayer.layer = 999;\nball.layer = 998;\nranks.hidden = true;\n\n// 創造敵人\nfor (let i = 0; i \u003c 10; i++) {\n let e = createSprite('g_0.png', 'g_1.png', 'g_2.png', 'g_3.png', 'g_4.png', 'g_5.png');\n e.rotationStyle = 'fixed';\n enemies.push(e); //存入敵人角色陣列\n}\n\n//createSound('bgm.mp3', true);\n\n// 開始新關卡\nfunction startLevel () {\n\n ball.hidden = true; //隱藏玩家雪球\n level.hidden = true; //隱藏開始畫面\n life = 3;\n\n // 初始化敵人位置、方向、計時器\n for (let i = 0; i \u003c 10; i++) {\n let e = enemies[i];\n e.x = Math.random() * 450;\n e.y = Math.random() * 450;\n e.direction = Math.floor(Math.random() * 4) * 90 + 45;\n e.timer = Math.floor(Math.random() * 180) + 180;\n // e.hidden = i \u003e= level.costumeId * 3 + 3;\n }\n}\n\n// 遊戲迴圈\nfunction gameloop () {\n // 關卡圖隱藏而且軍階圖隱藏\n if (level.hidden \u0026\u0026 ranks.hidden) {\n updatePlayer(); // 更新玩家\n enemies.forEach(updateEnemy); // 更新敵人\n balls.forEach(updateBall); // 更新敵人的雪球\n checkIsGameover(); // 檢查遊戲使否結束\n }\n \n if (level.y \u003c 450) level.y += 30;\n if (ranks.y \u003c 450) ranks.y += 30;\n}\n\n// 更新敵人\nfunction updateEnemy (e) {\n\n e.timer -= 1;\n\n if (e.timer \u003e 180) {\n e.stepForward(3);\n e.costumeId = Math.floor(e.timer / 10) % 2;\n }\n if (e.timer == 180) {\n e.costumeId = 2;\n }\n if (e.timer == 120) {\n e.costumeId = 3;\n }\n if (e.timer == 60 \u0026\u0026 e.hidden == false) {\n e.costumeId = 4;\n createBall(e.x, e.y);\n //createSound('shoot.mp3');\n }\n if (e.timer == 0) {\n e.direction = Math.floor(Math.random() * 4) * 90 + 45;\n e.timer = Math.floor(Math.random() * 180) + 180;\n }\n\n // 如果超出邊界就反轉\n if (e.x \u003c 0 || e.y \u003c 0 || e.x + e.y \u003e 900) {\n e.direction += 180;\n }\n\n // 如果碰到玩家的雪球\n if (e.touched(ball) \u0026\u0026 e.costumeId != 5) {\n ball.hidden = true; // 隱藏玩家雪球\n e.costumeId = 5;\n e.timer = -1;\n }\n \n}\n\n// 更新玩家\nfunction updatePlayer () {\n\n if (cursor.x + cursor.y \u003e 1200) {\n player.moveTo(cursor); // 角色跟著滑鼠移動\n }\n\n if (cursor.isDown) {\n if (ball.hidden) //createSound('shoot.mp3');\n player.costumeId = 1; //瞄準\n ball.hidden = false;\n ball.moveTo(player);\n } else {\n player.costumeId = 0; //放下\n ball.move(-20, -20);\n }\n}\n\n// 更新敵人雪球\nfunction updateBall (b) {\n b.move(10, 10); // 朝右下移動\n if (b.x \u003e 1200 || b.y \u003e 900) {\n b.destroy();\n }\n\n // 如果雪球丟到玩家\n if (b.touched(player)) {\n b.destroy();\n player.costumeId = 2;\n stop();\n }\n}\n\n// 檢查遊戲是否結束\nfunction checkIsGameover () {\n let count = 0; // 死亡的敵人數量\n}\n\n// 該關卡獲勝\nfunction win () {\n level.hidden = false; // 顯示關卡開始圖\n level.costumeId += 1; // 切換下一張造型\n if (level.costumeId == 12) gameover(); // 最高等級就結束遊戲\n level.y = -450;\n}\n\n// 遊戲失敗\nfunction gameover () {\n player.costumeId = 2; // 玩家切換倒地造型\n ranks.hidden = false; // 顯示軍階圖\n ranks.costumeId = level.costumeId; // 設定軍階\n ranks.y = -450;\n}\n\n// 敵人創造雪球\nfunction createBall (x, y) {\n let ball = createSprite('ball.png');\n ball.moveTo(x, y);\n balls.push(ball);\n}\n\nforever(gameloop); // 不斷執行遊戲迴圈\nlevel.on('click', startLevel); // 點擊等級圖開始關卡\nstartLevel();\n\n","created_at":"2021-12-20T15:38:09.712+08:00","updated_at":"2021-12-24T15:42:48.236+08:00","name":"雪球大戰(預設版)","language":"javascript","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/328959/b230fa3bcc0fafe3f75ee57f07ce202f.jpg"},"parent_id":326069,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":172,"hashid":"wdks46gd2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6946938,"file_name":"L4.png","project_id":328959,"asset_id":453718,"created_at":"2021-12-22T11:29:21.180+08:00","updated_at":"2021-12-22T11:29:21.180+08:00"},{"id":6946939,"file_name":"L5.png","project_id":328959,"asset_id":453719,"created_at":"2021-12-22T11:29:21.185+08:00","updated_at":"2021-12-22T11:29:21.185+08:00"},{"id":6946940,"file_name":"L6.png","project_id":328959,"asset_id":453720,"created_at":"2021-12-22T11:29:21.190+08:00","updated_at":"2021-12-22T11:29:21.190+08:00"},{"id":6946941,"file_name":"L7.png","project_id":328959,"asset_id":453721,"created_at":"2021-12-22T11:29:21.195+08:00","updated_at":"2021-12-22T11:29:21.195+08:00"},{"id":6946942,"file_name":"L8.png","project_id":328959,"asset_id":453722,"created_at":"2021-12-22T11:29:21.199+08:00","updated_at":"2021-12-22T11:29:21.199+08:00"},{"id":6946943,"file_name":"L9.png","project_id":328959,"asset_id":453723,"created_at":"2021-12-22T11:29:21.204+08:00","updated_at":"2021-12-22T11:29:21.204+08:00"},{"id":6946944,"file_name":"L10.png","project_id":328959,"asset_id":453724,"created_at":"2021-12-22T11:29:21.209+08:00","updated_at":"2021-12-22T11:29:21.209+08:00"},{"id":6946945,"file_name":"L11.png","project_id":328959,"asset_id":453725,"created_at":"2021-12-22T11:29:21.214+08:00","updated_at":"2021-12-22T11:29:21.214+08:00"},{"id":6946908,"file_name":"r_2.png","project_id":328959,"asset_id":453688,"created_at":"2021-12-22T11:29:21.036+08:00","updated_at":"2021-12-22T11:29:21.036+08:00"},{"id":6946909,"file_name":"r_1.png","project_id":328959,"asset_id":453689,"created_at":"2021-12-22T11:29:21.040+08:00","updated_at":"2021-12-22T11:29:21.040+08:00"},{"id":6946910,"file_name":"r_0.png","project_id":328959,"asset_id":453690,"created_at":"2021-12-22T11:29:21.043+08:00","updated_at":"2021-12-22T11:29:21.043+08:00"},{"id":6946913,"file_name":"g_4.png","project_id":328959,"asset_id":453693,"created_at":"2021-12-22T11:29:21.055+08:00","updated_at":"2021-12-22T11:29:21.055+08:00"},{"id":6946914,"file_name":"g_3.png","project_id":328959,"asset_id":453694,"created_at":"2021-12-22T11:29:21.058+08:00","updated_at":"2021-12-22T11:29:21.058+08:00"},{"id":6946915,"file_name":"g_2.png","project_id":328959,"asset_id":453695,"created_at":"2021-12-22T11:29:21.062+08:00","updated_at":"2021-12-22T11:29:21.062+08:00"},{"id":6946916,"file_name":"g_1.png","project_id":328959,"asset_id":453696,"created_at":"2021-12-22T11:29:21.066+08:00","updated_at":"2021-12-22T11:29:21.066+08:00"},{"id":6946917,"file_name":"g_0.png","project_id":328959,"asset_id":453697,"created_at":"2021-12-22T11:29:21.070+08:00","updated_at":"2021-12-22T11:29:21.070+08:00"},{"id":6946918,"file_name":"ball.png","project_id":328959,"asset_id":453698,"created_at":"2021-12-22T11:29:21.078+08:00","updated_at":"2021-12-22T11:29:21.078+08:00"},{"id":6946919,"file_name":"r12.png","project_id":328959,"asset_id":453699,"created_at":"2021-12-22T11:29:21.083+08:00","updated_at":"2021-12-22T11:29:21.083+08:00"},{"id":6946920,"file_name":"r11.png","project_id":328959,"asset_id":453700,"created_at":"2021-12-22T11:29:21.088+08:00","updated_at":"2021-12-22T11:29:21.088+08:00"},{"id":6946921,"file_name":"r10.png","project_id":328959,"asset_id":453701,"created_at":"2021-12-22T11:29:21.092+08:00","updated_at":"2021-12-22T11:29:21.092+08:00"},{"id":6946922,"file_name":"r9.png","project_id":328959,"asset_id":453702,"created_at":"2021-12-22T11:29:21.097+08:00","updated_at":"2021-12-22T11:29:21.097+08:00"},{"id":6946923,"file_name":"r8.png","project_id":328959,"asset_id":453703,"created_at":"2021-12-22T11:29:21.102+08:00","updated_at":"2021-12-22T11:29:21.102+08:00"},{"id":6946924,"file_name":"r7.png","project_id":328959,"asset_id":453704,"created_at":"2021-12-22T11:29:21.106+08:00","updated_at":"2021-12-22T11:29:21.106+08:00"},{"id":6946925,"file_name":"r6.png","project_id":328959,"asset_id":453705,"created_at":"2021-12-22T11:29:21.111+08:00","updated_at":"2021-12-22T11:29:21.111+08:00"},{"id":6946926,"file_name":"r5.png","project_id":328959,"asset_id":453706,"created_at":"2021-12-22T11:29:21.115+08:00","updated_at":"2021-12-22T11:29:21.115+08:00"},{"id":6946927,"file_name":"r4.png","project_id":328959,"asset_id":453707,"created_at":"2021-12-22T11:29:21.120+08:00","updated_at":"2021-12-22T11:29:21.120+08:00"},{"id":6946928,"file_name":"r3.png","project_id":328959,"asset_id":453708,"created_at":"2021-12-22T11:29:21.124+08:00","updated_at":"2021-12-22T11:29:21.124+08:00"},{"id":6946929,"file_name":"r2.png","project_id":328959,"asset_id":453709,"created_at":"2021-12-22T11:29:21.137+08:00","updated_at":"2021-12-22T11:29:21.137+08:00"},{"id":6946930,"file_name":"r1.png","project_id":328959,"asset_id":453710,"created_at":"2021-12-22T11:29:21.142+08:00","updated_at":"2021-12-22T11:29:21.142+08:00"},{"id":6946931,"file_name":"r0.png","project_id":328959,"asset_id":453711,"created_at":"2021-12-22T11:29:21.146+08:00","updated_at":"2021-12-22T11:29:21.146+08:00"},{"id":6946932,"file_name":"L12.png","project_id":328959,"asset_id":453712,"created_at":"2021-12-22T11:29:21.151+08:00","updated_at":"2021-12-22T11:29:21.151+08:00"},{"id":6946933,"file_name":"bg.png","project_id":328959,"asset_id":453713,"created_at":"2021-12-22T11:29:21.155+08:00","updated_at":"2021-12-22T11:29:21.155+08:00"},{"id":6946934,"file_name":"L0.png","project_id":328959,"asset_id":453714,"created_at":"2021-12-22T11:29:21.161+08:00","updated_at":"2021-12-22T11:29:21.161+08:00"},{"id":6946935,"file_name":"L1.png","project_id":328959,"asset_id":453715,"created_at":"2021-12-22T11:29:21.165+08:00","updated_at":"2021-12-22T11:29:21.165+08:00"},{"id":6946936,"file_name":"L2.png","project_id":328959,"asset_id":453716,"created_at":"2021-12-22T11:29:21.170+08:00","updated_at":"2021-12-22T11:29:21.170+08:00"},{"id":6946937,"file_name":"L3.png","project_id":328959,"asset_id":453717,"created_at":"2021-12-22T11:29:21.175+08:00","updated_at":"2021-12-22T11:29:21.175+08:00"},{"id":6946911,"file_name":"g_5.png","project_id":328959,"asset_id":453691,"created_at":"2021-12-22T11:29:21.047+08:00","updated_at":"2021-12-22T12:06:37.259+08:00"},{"id":6960544,"file_name":"hit.mp3","project_id":328959,"asset_id":453911,"created_at":"2021-12-23T16:29:29.479+08:00","updated_at":"2021-12-23T16:29:29.479+08:00"},{"id":6960545,"file_name":"shoot.mp3","project_id":328959,"asset_id":453912,"created_at":"2021-12-23T16:29:29.481+08:00","updated_at":"2021-12-23T16:29:29.481+08:00"},{"id":6960546,"file_name":"bgm.mp3","project_id":328959,"asset_id":453913,"created_at":"2021-12-23T16:36:07.620+08:00","updated_at":"2021-12-23T16:36:07.620+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦