{"id":512559,"student_id":10,"content":"setBackdrop('bg.png'); //設定背景\nlet player = createSprite('r_0.png', 'r_1.png', 'r_2.png'); //玩家\nlet ball = createSprite('ball.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 enemies = []; //存放敵人角色\nlet balls = []; //存放敵人雪球\nlet life = 3; //玩家血量\nlet steps = 200; //進場步數\n\nlevel.layer = 1000; //設定圖層最上\nranks.layer = 1000; //設定圖層第二\nplayer.layer = 999; //設定圖層第三\nball.layer = 998; //設定圖層第四\nranks.hidden = true; //隱藏軍階圖\nball.hidden = true; //隱藏玩家雪球\nlevel.costumeId = 5\n\n// 創造 36 個敵人\nfor (let i = 0; i \u003c 36; i++) {\n let e = createSprite('g_0.png', 'g_1.png', 'g_2.png', 'g_3.png', 'g_4.png', 'g_5.png', 'g_6.png');\n e.rotationStyle = 'fixed';\n enemies.push(e);\n}\n\nlevel.on('click', startLevel); // 點擊等級圖開始關卡\nforever(gameloop); // 不斷執行遊戲迴圈\n\n// 開始新的關卡\nfunction startLevel () {\n life = 3; //恢復玩家血量\n ball.hidden = true; //隱藏玩家雪球\n level.hidden = true; //隱藏關卡圖\n for (let i = 0; i \u003c 36; i++) {\n let e = enemies[i];\n e.x = Math.random() * 450; // 隨機設定 x 座標\n e.y = Math.random() * 450; // 隨機設定 y 座標\n e.costumeId = 0; //恢復造型\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 if (level.y \u003c 450) level.y += 20; //向下滑動\n if (ranks.y \u003c 450) ranks.y += 20; //向下滑動\n}\n\n// 更新玩家\nfunction updatePlayer () {\n if (cursor.x + cursor.y \u003e 1200) {\n player.moveTo(cursor); //跟著滑鼠移動\n }\n\n if (cursor.isDown) {\n player.costumeId = 1; //準備雪球造型\n ball.moveTo(player); //移動雪球至玩家所在\n ball.hidden = false; //顯示雪球\n } else {\n player.costumeId = 0; //恢復造型\n ball.move(-20, -20); //玩家雪球不斷向左上移動\n }\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 }\n if (e.timer == 0) {\n e.timer = Math.floor(Math.random() * 200) + 180; //設定計時器\n e.direction = Math.floor(Math.random() * 4) * 90 + 45; //隨機方向\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 if (e.touched(ball) \u0026\u0026 e.costumeId \u003c 5) {\n ball.hidden = true; //隱藏玩家雪球\n e.timer = -1; //計時器設定 -1\n e.costumeId = 5; //變成倒一半的圖\n }\n if (e.timer == -8) {\n e.costumeId = 6; //變成完全倒地的圖\n }\n\n e.layer = e.y; // 角色越下面圖層越上層\n if (e.costumeId == 6) e.layer -= 200; // 降低暈倒的叩叮圖層\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 if (b.touched(player)) {\n b.destroy(); //移除角色\n lif -= 1; //玩家血量 -1\n }\n}\n\n// 檢查遊戲是否結束\nfunction checkIsGameover () {\n let count = 0; //紀錄隱藏或倒地的敵人數量\n for (let i = 0; i \u003c 36; i++) {\n if (enemies[i].hidden || enemies[i].costumeId == 6) {\n count += 1; //敵人隱藏或暈倒計數 +1\n }\n }\n if (count == 36) win(); //關卡獲勝\n if (life \u003c= 0) gameover(); //遊戲結束\n}\n\n// 該關卡獲勝\nfunction win () {\n level.costumeId += 1; //關卡等級切換下個造型\n level.hidden = false; //顯使關卡等級\n level.y = -450; //初始化滑入位置\n if (level.costumeId == 12) gameover(); // 最高等級就結束遊戲\n}\n\n// 遊戲失敗\nfunction gameover () {\n player.costumeId = 2; //切換倒地造型\n ranks.hidden = true; //顯示軍階圖\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}","created_at":"2023-03-31T10:40:20.990+08:00","updated_at":"2024-06-11T18:26:11.687+08:00","name":"雪球大戰(除錯預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/512559/691902033b29b351774292fa258a2f93.jpg"},"parent_id":512550,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":104,"hashid":"rdvs45m3r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":11666569,"file_name":"r7.png","project_id":512559,"asset_id":616954,"created_at":"2023-03-31T10:40:21.008+08:00","updated_at":"2023-03-31T10:40:21.008+08:00"},{"id":11666570,"file_name":"r6.png","project_id":512559,"asset_id":616955,"created_at":"2023-03-31T10:40:21.015+08:00","updated_at":"2023-03-31T10:40:21.015+08:00"},{"id":11666571,"file_name":"r5.png","project_id":512559,"asset_id":616956,"created_at":"2023-03-31T10:40:21.016+08:00","updated_at":"2023-03-31T10:40:21.016+08:00"},{"id":11666572,"file_name":"r4.png","project_id":512559,"asset_id":616957,"created_at":"2023-03-31T10:40:21.018+08:00","updated_at":"2023-03-31T10:40:21.018+08:00"},{"id":11666573,"file_name":"r3.png","project_id":512559,"asset_id":616958,"created_at":"2023-03-31T10:40:21.019+08:00","updated_at":"2023-03-31T10:40:21.019+08:00"},{"id":11666574,"file_name":"r2.png","project_id":512559,"asset_id":616959,"created_at":"2023-03-31T10:40:21.020+08:00","updated_at":"2023-03-31T10:40:21.020+08:00"},{"id":11666575,"file_name":"r1.png","project_id":512559,"asset_id":616960,"created_at":"2023-03-31T10:40:21.022+08:00","updated_at":"2023-03-31T10:40:21.022+08:00"},{"id":11666576,"file_name":"r0.png","project_id":512559,"asset_id":616961,"created_at":"2023-03-31T10:40:21.023+08:00","updated_at":"2023-03-31T10:40:21.023+08:00"},{"id":11666577,"file_name":"r_2.png","project_id":512559,"asset_id":616962,"created_at":"2023-03-31T10:40:21.024+08:00","updated_at":"2023-03-31T10:40:21.024+08:00"},{"id":11666578,"file_name":"r_1.png","project_id":512559,"asset_id":616963,"created_at":"2023-03-31T10:40:21.026+08:00","updated_at":"2023-03-31T10:40:21.026+08:00"},{"id":11666579,"file_name":"r_0.png","project_id":512559,"asset_id":616964,"created_at":"2023-03-31T10:40:21.027+08:00","updated_at":"2023-03-31T10:40:21.027+08:00"},{"id":11666580,"file_name":"g_6.png","project_id":512559,"asset_id":616965,"created_at":"2023-03-31T10:40:21.028+08:00","updated_at":"2023-03-31T10:40:21.028+08:00"},{"id":11666581,"file_name":"g_5.png","project_id":512559,"asset_id":616966,"created_at":"2023-03-31T10:40:21.030+08:00","updated_at":"2023-03-31T10:40:21.030+08:00"},{"id":11666582,"file_name":"g_4.png","project_id":512559,"asset_id":616967,"created_at":"2023-03-31T10:40:21.031+08:00","updated_at":"2023-03-31T10:40:21.031+08:00"},{"id":11666583,"file_name":"g_3.png","project_id":512559,"asset_id":616968,"created_at":"2023-03-31T10:40:21.033+08:00","updated_at":"2023-03-31T10:40:21.033+08:00"},{"id":11666584,"file_name":"g_2.png","project_id":512559,"asset_id":616969,"created_at":"2023-03-31T10:40:21.034+08:00","updated_at":"2023-03-31T10:40:21.034+08:00"},{"id":11666585,"file_name":"g_1.png","project_id":512559,"asset_id":616970,"created_at":"2023-03-31T10:40:21.035+08:00","updated_at":"2023-03-31T10:40:21.035+08:00"},{"id":11666586,"file_name":"g_0.png","project_id":512559,"asset_id":616971,"created_at":"2023-03-31T10:40:21.036+08:00","updated_at":"2023-03-31T10:40:21.036+08:00"},{"id":11666587,"file_name":"ball.png","project_id":512559,"asset_id":616972,"created_at":"2023-03-31T10:40:21.037+08:00","updated_at":"2023-03-31T10:40:21.037+08:00"},{"id":11666588,"file_name":"r12.png","project_id":512559,"asset_id":616973,"created_at":"2023-03-31T10:40:21.038+08:00","updated_at":"2023-03-31T10:40:21.038+08:00"},{"id":11666589,"file_name":"r11.png","project_id":512559,"asset_id":616974,"created_at":"2023-03-31T10:40:21.039+08:00","updated_at":"2023-03-31T10:40:21.039+08:00"},{"id":11666590,"file_name":"r10.png","project_id":512559,"asset_id":616975,"created_at":"2023-03-31T10:40:21.040+08:00","updated_at":"2023-03-31T10:40:21.040+08:00"},{"id":11666591,"file_name":"r9.png","project_id":512559,"asset_id":616976,"created_at":"2023-03-31T10:40:21.041+08:00","updated_at":"2023-03-31T10:40:21.041+08:00"},{"id":11666592,"file_name":"r8.png","project_id":512559,"asset_id":616977,"created_at":"2023-03-31T10:40:21.042+08:00","updated_at":"2023-03-31T10:40:21.042+08:00"},{"id":11666593,"file_name":"L12.png","project_id":512559,"asset_id":616978,"created_at":"2023-03-31T10:40:21.043+08:00","updated_at":"2023-03-31T10:40:21.043+08:00"},{"id":11666594,"file_name":"bg.png","project_id":512559,"asset_id":616979,"created_at":"2023-03-31T10:40:21.044+08:00","updated_at":"2023-03-31T10:40:21.044+08:00"},{"id":11666595,"file_name":"L0.png","project_id":512559,"asset_id":616980,"created_at":"2023-03-31T10:40:21.045+08:00","updated_at":"2023-03-31T10:40:21.045+08:00"},{"id":11666596,"file_name":"L1.png","project_id":512559,"asset_id":616981,"created_at":"2023-03-31T10:40:21.046+08:00","updated_at":"2023-03-31T10:40:21.046+08:00"},{"id":11666597,"file_name":"L2.png","project_id":512559,"asset_id":616982,"created_at":"2023-03-31T10:40:21.047+08:00","updated_at":"2023-03-31T10:40:21.047+08:00"},{"id":11666598,"file_name":"L3.png","project_id":512559,"asset_id":616983,"created_at":"2023-03-31T10:40:21.048+08:00","updated_at":"2023-03-31T10:40:21.048+08:00"},{"id":11666599,"file_name":"L4.png","project_id":512559,"asset_id":616984,"created_at":"2023-03-31T10:40:21.049+08:00","updated_at":"2023-03-31T10:40:21.049+08:00"},{"id":11666600,"file_name":"L5.png","project_id":512559,"asset_id":616985,"created_at":"2023-03-31T10:40:21.050+08:00","updated_at":"2023-03-31T10:40:21.050+08:00"},{"id":11666601,"file_name":"L6.png","project_id":512559,"asset_id":616986,"created_at":"2023-03-31T10:40:21.051+08:00","updated_at":"2023-03-31T10:40:21.051+08:00"},{"id":11666602,"file_name":"L7.png","project_id":512559,"asset_id":616987,"created_at":"2023-03-31T10:40:21.052+08:00","updated_at":"2023-03-31T10:40:21.052+08:00"},{"id":11666603,"file_name":"L8.png","project_id":512559,"asset_id":616988,"created_at":"2023-03-31T10:40:21.053+08:00","updated_at":"2023-03-31T10:40:21.053+08:00"},{"id":11666604,"file_name":"L9.png","project_id":512559,"asset_id":616989,"created_at":"2023-03-31T10:40:21.054+08:00","updated_at":"2023-03-31T10:40:21.054+08:00"},{"id":11666605,"file_name":"L10.png","project_id":512559,"asset_id":616990,"created_at":"2023-03-31T10:40:21.055+08:00","updated_at":"2023-03-31T10:40:21.055+08:00"},{"id":11666606,"file_name":"L11.png","project_id":512559,"asset_id":616991,"created_at":"2023-03-31T10:40:21.056+08:00","updated_at":"2023-03-31T10:40:21.056+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦