{"id":323284,"student_id":10,"content":"setBackdrop(\"#333\");\nlet player = createSprite('p_0.png', 'p_1.png', 'p_2.png');\nlet diamond = createSprite('d_0.png', 'd_1.png', 'd_2.png');\nlet board = createSprite('_board.png');\n// let cover = createSprite('cover.png');\nlet gameover = createSprite('gameover.png');\nlet target;\nlet score = 0;\n\nplayer.layer = 1;\nboard.layer = 2;\ndiamond.layer = 2;\n\ngameover.hidden = true;\ngameover.layer = 3;\n\nlet blocks = [];\nlet clock = -120;\n\n\nplayer.rotationStyle = 'flipped';\nplayer.layer = 1;\ndiamond.layer = 1;\n// cover.layer = 2;\nspeed = 0;\n\nlet count = [0, 0, 0];\n\nfunction reset () {\n for (let x = 0; x \u003c 10; x++) {\n for (let y = 0; y \u003c 6; y++) {\n let block = createSprite('b_0.png', 'b_1.png', 'b_2.png', 'b_3.png', 'b_4.png', 'b_5.png');\n block.x = x * 100 + 150;\n block.y = y * 100 + 150;\n if (x % 2 == 0) block.y += 50;\n \n let rand = Math.random();\n if (rand \u003c 0.8) block.costumeId = 0;\n else if (rand \u003c 0.9) block.costumeId = 2;\n else if (rand \u003c 0.95) block.costumeId = 3;\n else block.costumeId = 4;\n \n blocks.push(block);\n }\n } \n}\n\nfunction gameloop () {\n clock++;\n if (clock == 0) {\n blocks.forEach(hideBlock);\n }\n\n blocks.forEach(open);\n\n if (clock \u003e 0 \u0026\u0026 target) {\n player.toward(target.x, target.y - 70);\n player.stepForward(5);\n\n if (player.distanceTo(target.x, target.y - 70) \u003c 10) {\n // target.costumeId = 3;\n target.costumeId = target.type;\n if (target.type == 0) target.costumeId = 1;\n if (target.type == 2) {\n count[0]++;\n score += 30;\n }\n if (target.type == 3) {\n count[1]++;\n score += 10;\n }\n if (target.type == 4) {\n count[2]++;\n score += 5;\n }\n\n if (target.type \u003e= 2) {\n diamond.costumeId = target.type - 2;\n diamond.hidden = false;\n diamond.moveTo(player);\n speed = -20;\n }\n target = undefined;\n\n player.costumeId = 1;\n player.timer = 30;\n }\n }\n \n player.timer -= 1;\n if (player.timer == 15) {\n player.costumeId = 2;\n }\n if (player.timer == 0) {\n player.costumeId = 0;\n }\n\n diamond.y += speed;\n diamond.direction += 10;\n speed += 1;\n if (diamond.y \u003e player.y) diamond.hidden = true;\n \n drawText(Math.floor(30 - clock / 60), 100, 820, 'black', 60);\n drawText(count[0], 300, 820, 'black', 60);\n drawText(count[1], 500, 820, 'black', 60);\n drawText(count[2], 700, 820, 'black', 60);\n drawText(score, 900, 820, 'black', 60);\n \n \n \n if (clock \u003e 1800) {\n gameover.hidden = false;\n }\n}\n\nfunction hideBlock (b) {\n b.type = b.costumeId;\n b.costumeId = 0;\n}\n\nfunction open (b) {\n if (b.touched(cursor) \u0026\u0026 cursor.isDown \u0026\u0026 b.costumeId == 0) {\n target = b;\n }\n}\n\ngameover.on('click', function () {\n gameover.destroy();\n let end = createSprite('end.png');\n end.scale = 0.8;\n stop();\n})\n\nforever(gameloop);\nreset();","created_at":"2021-12-07T18:47:02.893+08:00","updated_at":"2021-12-08T16:19:01.084+08:00","name":"企鵝挖寶藏","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/323284/4f823c8e12174b134a266256d6c44356.jpg"},"parent_id":2,"plugin":"Game.set({ width: 1200, height: 900 });","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":366,"hashid":"jzmsejge4","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6757048,"file_name":"end.png","project_id":323284,"asset_id":447585,"created_at":"2021-12-08T16:14:54.313+08:00","updated_at":"2021-12-08T16:14:54.313+08:00"},{"id":6755261,"file_name":"p_0.png","project_id":323284,"asset_id":446433,"created_at":"2021-12-07T23:25:49.101+08:00","updated_at":"2021-12-07T23:25:49.101+08:00"},{"id":6755262,"file_name":"p_2.png","project_id":323284,"asset_id":446434,"created_at":"2021-12-07T23:25:49.103+08:00","updated_at":"2021-12-07T23:25:49.103+08:00"},{"id":6755205,"file_name":"d_1.png","project_id":323284,"asset_id":446432,"created_at":"2021-12-07T22:13:33.107+08:00","updated_at":"2021-12-07T23:00:45.350+08:00"},{"id":6755203,"file_name":"d_2.png","project_id":323284,"asset_id":446430,"created_at":"2021-12-07T22:13:32.247+08:00","updated_at":"2021-12-07T22:13:32.247+08:00"},{"id":6755204,"file_name":"d_0.png","project_id":323284,"asset_id":446431,"created_at":"2021-12-07T22:13:32.249+08:00","updated_at":"2021-12-07T23:00:49.962+08:00"},{"id":6755263,"file_name":"p_1.png","project_id":323284,"asset_id":446435,"created_at":"2021-12-07T23:25:49.695+08:00","updated_at":"2021-12-07T23:25:49.695+08:00"},{"id":6755354,"file_name":"timeout.png","project_id":323284,"asset_id":446438,"created_at":"2021-12-08T11:35:57.768+08:00","updated_at":"2021-12-08T11:35:57.768+08:00"},{"id":6755356,"file_name":"b_4.png","project_id":323284,"asset_id":446440,"created_at":"2021-12-08T11:47:10.431+08:00","updated_at":"2021-12-08T11:47:10.431+08:00"},{"id":6755357,"file_name":"b_3.png","project_id":323284,"asset_id":446441,"created_at":"2021-12-08T11:47:10.433+08:00","updated_at":"2021-12-08T11:47:10.433+08:00"},{"id":6755358,"file_name":"b_2.png","project_id":323284,"asset_id":446442,"created_at":"2021-12-08T11:47:11.525+08:00","updated_at":"2021-12-08T11:47:11.525+08:00"},{"id":6755359,"file_name":"b_1.png","project_id":323284,"asset_id":446443,"created_at":"2021-12-08T11:47:11.527+08:00","updated_at":"2021-12-08T11:47:11.527+08:00"},{"id":6755360,"file_name":"b_0.png","project_id":323284,"asset_id":446444,"created_at":"2021-12-08T11:47:12.059+08:00","updated_at":"2021-12-08T11:47:12.059+08:00"},{"id":6755361,"file_name":"b_5.png","project_id":323284,"asset_id":446445,"created_at":"2021-12-08T13:08:13.431+08:00","updated_at":"2021-12-08T13:08:13.431+08:00"},{"id":6755355,"file_name":"gameover.png","project_id":323284,"asset_id":446439,"created_at":"2021-12-08T11:35:57.770+08:00","updated_at":"2021-12-08T15:34:21.145+08:00"},{"id":6755920,"file_name":"_board.png","project_id":323284,"asset_id":446456,"created_at":"2021-12-08T15:23:47.954+08:00","updated_at":"2021-12-08T15:23:53.629+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