{"id":317582,"student_id":10,"content":"let bg = createSprite('bg.png'); // 背景圖\nlet item = createSprite('item_0.png', 'item_1.png', 'item_2.png'); // 道具\nlet player = createSprite('p_0.png', 'p_1.png', 'p_2.png', 'p_3.png'); // 叩叮玩家\nlet monster = createSprite('monster_0.png', 'monster_1.png', 'monster_2.png'); // 怪物\nlet gameover = createSprite('gameover.png'); // 遊戲結束\nlet bubble = createSprite('item_2.png');\nlet numbers = ['0.png', '1.png', '2.png', '3.png', '4.png', '5.png', '6.png', '7.png', '8.png', '9.png'];\nlet num1 = createSprite(numbers);\nlet num2 = createSprite(numbers);\nlet num3 = createSprite(numbers);\nlet num4 = createSprite(numbers);\n\nlet speed = 0; //向上跳的速度\nlet score = 0; //完成的階梯數\nlet timer = 0; //道具作用剩餘時間\nlet blocks = []; // 存放階梯的陣列\n\nnum1.moveTo(30, 50);\nnum2.moveTo(100, 50);\nnum3.moveTo(170, 50);\nnum4.moveTo(240, 50);\n\nnum1.layer = num2.layer = num3.layer = num4.layer = 4;\nplayer.layer = 1;\nitem.layer = 2;\ngameover.layer = 3;\nplayer.rotationStyle = 'flipped';\ngameover.hidden = true;\nbubble.scale = 1.5;\nbubble.hidden = true;\n\n// 使用迴圈創造 16 個階梯角色\nfor (let i = 0; i \u003c 16; i++) {\n let b = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png');\n blocks.push(b); // 將階梯角色存入陣列\n}\n\n// 開始遊戲\nfunction restart () {\n speed = 0;\n score = 0;\n timer = 0;\n for (let i = 0; i \u003c 16; i++) {\n blocks[i].x = Math.random() * 1200;\n blocks[i].y = 900 - i * 60;\n blocks[i].costumeId = 0;\n }\n item.y = -1500;\n monster.y = -3000;\n player.moveTo(600, 450);\n player.costumeId = 0;\n}\n\n// //遊戲迴圈\nfunction gameloop () {\n updateBackground(); //更新背景圖\n updatePlayer(); //更新玩家\n blocks.forEach(updateBlock); //更新階梯\n blocks.forEach(touchedDetect); //階梯碰撞偵測\n scroll(); // 捲動所有角色\n updateItem(); //更新道具\n updateMonster(); //更新怪物\n updateScore(); //更新遊戲分數\n \n gameover.hidden = player.y \u003c 1000;\n bubble.moveTo(player);\n}\n\n// 更新玩家位置\nfunction updatePlayer() {\n // 右鍵按下\n if (key.right) {\n player.x += 10;\n player.direction = 90; //圖片朝向右\n }\n // 左鍵按下\n if (key.left) {\n player.x -= 10;\n player.direction = 270; //圖片朝向左\n }\n if (player.x \u003c 0) player.x += 1200;\n if (player.x \u003e 1200) player.x -= 1200;\n\n speed -= 0.5; // 引力減少向上速度\n player.y -= speed; // 根據速度改變垂直位置\n \n if (player.costumeId == 1) speed = 30;\n if (player.costumeId == 2) speed = 60;\n \n timer -= 1;\n if (timer \u003c 0 \u0026\u0026 player.costumeId != 3) player.costumeId = 0;\n}\n\n// 捲動整個遊戲畫面\nfunction scroll () {\n // if (player.y \u003c 450) {\n let offset = 450 - player.y; //向下捲動的距離\n bg.y += offset;\n item.y += offset;\n player.y += offset;\n monster.y += offset;\n for (let i = 0; i \u003c 16; i++) {\n blocks[i].y += offset;\n }\n // }\n}\n\n// 更新背景圖\nfunction updateBackground () {\n if (bg.y \u003e 900) bg.y -= 1800;\n}\n\n// 更新道具\nfunction updateItem () {\n if (item.y \u003e 1000) {\n item.y -= 3000;\n item.x = Math.random() * 1200;\n item.hidden = false;\n item.costumeId = Math.floor(Math.random() * 3);\n }\n if (item.touched(player)) {\n item.hidden = true;\n if (item.costumeId == 0) {\n player.costumeId = 1;\n timer = 60;\n }\n if (item.costumeId == 1) {\n player.costumeId = 2;\n timer = 120;\n }\n if (item.costumeId == 2) {\n bubble.hidden = false;\n }\n }\n}\n\n// 更新階梯位置\nfunction updateBlock (block) {\n if (block.y \u003e 930) {\n block.y -= 60 * 16 + score * 2;\n block.x = Math.random() * 1200;\n score += 1;\n let rand = Math.random();\n if (rand \u003c 0.6) block.costumeId = 0;\n else if (rand \u003c 0.8) block.costumeId = 1;\n else if (rand \u003c 0.9) block.costumeId = 2;\n else block.costumeId = 3;\n block.hidden = false;\n }\n if (block.costumeId == 3) {\n block.x += 5;\n if (block.x \u003e 1300) {\n block.x -= 1400;\n }\n }\n}\n\n// 必須跟更新位置分開,不能在沒更新完階梯時改變 speed 速度\nfunction touchedDetect (block) {\n if (block.touched(player) \u0026\u0026 player.y \u003c block.y - 50 \u0026\u0026 speed \u003c 0 \u0026\u0026 player.costumeId != 3) {\n speed = 20;\n block.scale = 1.3;\n \n if (block.costumeId == 1) speed = 40;\n if (block.costumeId == 2) block.hidden = true;\n }\n if (block.scale \u003e 1) {\n block.scale -= 0.03;\n }\n}\n\n\n// 更新怪物\nfunction updateMonster () {\n if (monster.y \u003e 1000) {\n monster.y -= 3000;\n monster.x = Math.random() * 1200;\n monster.costumeId = Math.floor(Math.random() * 3);\n monster.hidden = false;\n }\n if (monster.touched(player)) {\n if (bubble.hidden == false) {\n bubble.hidden = true;\n monster.hidden = true;\n } else {\n player.costumeId = 3; \n }\n }\n}\n\n// 更新分數\nfunction updateScore () {\n num1.costumeId = Math.floor(score / 1000) % 10;\n num2.costumeId = Math.floor(score / 100) % 10;\n num3.costumeId = Math.floor(score / 10) % 10;\n num4.costumeId = Math.floor(score / 1) % 10;\n}\n\n\nforever(gameloop); //不斷執行遊戲迴圈\ngameover.on('click', restart); // 點擊遊戲結束圖重新開始\nrestart(); //開始遊戲","created_at":"2021-11-23T10:51:15.535+08:00","updated_at":"2021-12-03T13:33:57.294+08:00","name":"攀岩高手(預設版)","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/317582/b230fa3bcc0fafe3f75ee57f07ce202f.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":660,"hashid":"ej9s2y89j","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6567642,"file_name":"bg.png","project_id":317582,"asset_id":348790,"created_at":"2021-11-23T10:51:29.722+08:00","updated_at":"2021-11-23T10:51:29.722+08:00"},{"id":6567643,"file_name":"b_0.png","project_id":317582,"asset_id":435222,"created_at":"2021-11-23T10:51:29.724+08:00","updated_at":"2021-11-23T10:51:29.724+08:00"},{"id":6567644,"file_name":"item_2.png","project_id":317582,"asset_id":435221,"created_at":"2021-11-23T10:51:30.250+08:00","updated_at":"2021-11-23T10:51:30.250+08:00"},{"id":6567645,"file_name":"monster_2.png","project_id":317582,"asset_id":348797,"created_at":"2021-11-23T10:51:30.251+08:00","updated_at":"2021-11-23T10:51:30.251+08:00"},{"id":6567646,"file_name":"p_3.png","project_id":317582,"asset_id":435226,"created_at":"2021-11-23T10:51:30.804+08:00","updated_at":"2021-11-23T10:51:30.804+08:00"},{"id":6567649,"file_name":"monster_0.png","project_id":317582,"asset_id":348795,"created_at":"2021-11-23T10:51:31.337+08:00","updated_at":"2021-11-23T10:51:31.337+08:00"},{"id":6567652,"file_name":"b_1.png","project_id":317582,"asset_id":435224,"created_at":"2021-11-23T10:51:32.618+08:00","updated_at":"2021-11-23T10:51:32.618+08:00"},{"id":6567653,"file_name":"p_0.png","project_id":317582,"asset_id":435230,"created_at":"2021-11-23T10:51:32.620+08:00","updated_at":"2021-11-23T10:51:32.620+08:00"},{"id":6567650,"file_name":"p_2.png","project_id":317582,"asset_id":435225,"created_at":"2021-11-23T10:51:32.044+08:00","updated_at":"2021-11-23T10:51:32.044+08:00"},{"id":6567651,"file_name":"p_1.png","project_id":317582,"asset_id":435223,"created_at":"2021-11-23T10:51:32.046+08:00","updated_at":"2021-11-23T10:51:32.046+08:00"},{"id":6567656,"file_name":"item_1.png","project_id":317582,"asset_id":435229,"created_at":"2021-11-23T10:51:33.714+08:00","updated_at":"2021-11-23T10:51:33.714+08:00"},{"id":6567657,"file_name":"gameover.png","project_id":317582,"asset_id":348791,"created_at":"2021-11-23T10:51:33.716+08:00","updated_at":"2021-11-23T10:51:33.716+08:00"},{"id":6567654,"file_name":"item_0.png","project_id":317582,"asset_id":435231,"created_at":"2021-11-23T10:51:33.163+08:00","updated_at":"2021-11-23T10:51:33.163+08:00"},{"id":6567655,"file_name":"monster_1.png","project_id":317582,"asset_id":348796,"created_at":"2021-11-23T10:51:33.165+08:00","updated_at":"2021-11-23T10:51:33.165+08:00"},{"id":6661041,"file_name":"1.png","project_id":317582,"asset_id":373204,"created_at":"2021-12-01T18:24:11.159+08:00","updated_at":"2021-12-01T18:24:11.159+08:00"},{"id":6661042,"file_name":"2.png","project_id":317582,"asset_id":373203,"created_at":"2021-12-01T18:24:11.160+08:00","updated_at":"2021-12-01T18:24:11.160+08:00"},{"id":6661046,"file_name":"3.png","project_id":317582,"asset_id":373202,"created_at":"2021-12-01T18:24:12.201+08:00","updated_at":"2021-12-01T18:24:12.201+08:00"},{"id":6661047,"file_name":"9.png","project_id":317582,"asset_id":373196,"created_at":"2021-12-01T18:24:12.900+08:00","updated_at":"2021-12-01T18:24:12.900+08:00"},{"id":6661048,"file_name":"8.png","project_id":317582,"asset_id":373197,"created_at":"2021-12-01T18:24:12.902+08:00","updated_at":"2021-12-01T18:24:12.902+08:00"},{"id":6661045,"file_name":"7.png","project_id":317582,"asset_id":373198,"created_at":"2021-12-01T18:24:12.199+08:00","updated_at":"2021-12-01T18:24:12.199+08:00"},{"id":6661039,"file_name":"4.png","project_id":317582,"asset_id":373201,"created_at":"2021-12-01T18:24:10.100+08:00","updated_at":"2021-12-01T18:24:10.100+08:00"},{"id":6661040,"file_name":"5.png","project_id":317582,"asset_id":373200,"created_at":"2021-12-01T18:24:10.103+08:00","updated_at":"2021-12-01T18:24:10.103+08:00"},{"id":6661043,"file_name":"6.png","project_id":317582,"asset_id":373199,"created_at":"2021-12-01T18:24:11.655+08:00","updated_at":"2021-12-01T18:24:11.655+08:00"},{"id":6661044,"file_name":"0.png","project_id":317582,"asset_id":373205,"created_at":"2021-12-01T18:24:11.657+08:00","updated_at":"2021-12-01T18:24:11.657+08:00"},{"id":6664989,"file_name":"fail.mp3","project_id":317582,"asset_id":444124,"created_at":"2021-12-02T11:36:52.447+08:00","updated_at":"2021-12-02T11:36:52.447+08:00"},{"id":6567648,"file_name":"b_2.png","project_id":317582,"asset_id":435227,"created_at":"2021-11-23T10:51:31.335+08:00","updated_at":"2021-12-02T17:07:53.566+08:00"},{"id":6567647,"file_name":"b_3.png","project_id":317582,"asset_id":435228,"created_at":"2021-11-23T10:51:30.806+08:00","updated_at":"2021-12-02T17:07:58.960+08:00"}]
Orange Apple Learning Platform
My Projects
View Project Page
Export
Remix
Import
Delete
Download Android APP (APK)
Screenshot
繁中
简中
English
日本語
1:1:1
1:1
Full Width
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer
Scan the QRCode below with your phone to install
Or you can
download APK
to this computer