{"id":313119,"student_id":10,"content":"let bg0 = createSprite('bg_0.png'); //背景1\nlet bg1 = createSprite('bg_1.png'); //背景2\nlet god = createSprite(\"god_0.png\", \"god_1.png\", \"god_2.png\"); //財神\nlet player = createSprite(\"p_0.png\", \"p_1.png\", \"p_2.png\", \"p_3.png\"); //玩家\n\nlet vx = 10; //財神水平移動的速度\nlet score = 0; //玩家分數\nlet timer = 1800; //遊戲時間\nlet items = []; //存放寶物的陣列\n\ngod.y = 250;\nplayer.y = 700;\n\n//遊戲主迴圈\nfunction gameloop () {\n\n updateTimer(); //更新計時器\n updatePlayer(); //更新玩家\n updateGod(); //更新財神\n updateItems(); //更新寶物\n createItems();\n\n drawText(Math.floor(timer / 60), 110, 825, 'white', 40); //顯示時間\n drawText(score, 340, 825, 'white', 40); //顯示分數\n\n}\n\n// 更新遊戲計時器\nfunction updateTimer () {\n if (timer \u003e 0) timer--;\n if (timer == 1) createSprite(\"timesup.png\");\n}\n\n// 玩家控制叩叮移動\nfunction updatePlayer () {\n if (timer \u003e 0) {\n if (key.right) {\n player.x += 10;\n }\n if (key.left) {\n player.x -= 10;\n }\n }\n}\n\n// 財神移動\nfunction updateGod () {\n if (timer \u003e 0) {\n god.x += vx;\n if (god.x \u003e 1100) vx = -10;\n if (god.x \u003c 100) vx = 10;\n if (Math.random() \u003c 0.02) vx = -vx;\n }\n}\n\n//創造財寶\nfunction createItems () {\n if (timer % 20 == 0 \u0026\u0026 timer \u003e 0) {\n let item = createSprite('item_0.png', 'item_1.png', 'item_2.png', 'item_3.png', 'item_4.png');\n item.x = god.x;\n item.y = god.y;\n item.vy = -10;\n item.costumeId = Math.floor(Math.random() * 5); // 設定隨機 0 - 4 造型編號\n items.push(item);\n }\n}\n\n// 更新財寶的位置\nfunction updateItems () {\n for (let i = 0; i \u003c items.length; i++) {\n items[i].y += items[i].vy;\n items[i].vy += 0.5;\n items[i].direction += 5;\n \n if (items[i].touched(player)) {\n items[i].destroy();\n if (items[i].costumeId == 4) {\n timer = 0;\n player.costumeId = 3;\n } else {\n score++;\n }\n \n }\n if (items[i].y \u003e 900) {\n items[i].destroy();\n }\n }\n}\n\nforever(gameloop); // 不斷執行遊戲迴圈","created_at":"2021-11-12T13:09:32.656+08:00","updated_at":"2021-11-12T15:55:04.854+08:00","name":"財神叩叮到(預設版) 副本","language":"javascript","screenshot":{"url":"https://cdn2.koding.school/uploads/project/screenshot/313119/9a2602154c461dab9ff9c73cf51c9a62.jpg"},"parent_id":313111,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":165,"hashid":"meyswep4y","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":6435414,"file_name":"bgm.mp3","project_id":313119,"asset_id":318397,"created_at":"2021-11-12T13:09:32.663+08:00","updated_at":"2021-11-12T13:09:32.663+08:00"},{"id":6435415,"file_name":"e4.mp3","project_id":313119,"asset_id":318399,"created_at":"2021-11-12T13:09:32.664+08:00","updated_at":"2021-11-12T13:09:32.664+08:00"},{"id":6435416,"file_name":"e3.mp3","project_id":313119,"asset_id":318400,"created_at":"2021-11-12T13:09:32.665+08:00","updated_at":"2021-11-12T13:09:32.665+08:00"},{"id":6435417,"file_name":"e1.mp3","project_id":313119,"asset_id":255906,"created_at":"2021-11-12T13:09:32.666+08:00","updated_at":"2021-11-12T13:09:32.666+08:00"},{"id":6435418,"file_name":"e2.mp3","project_id":313119,"asset_id":318401,"created_at":"2021-11-12T13:09:32.667+08:00","updated_at":"2021-11-12T13:09:32.667+08:00"},{"id":6435419,"file_name":"item_1.png","project_id":313119,"asset_id":322148,"created_at":"2021-11-12T13:09:32.668+08:00","updated_at":"2021-11-12T13:09:32.668+08:00"},{"id":6435420,"file_name":"item_3.png","project_id":313119,"asset_id":322144,"created_at":"2021-11-12T13:09:32.669+08:00","updated_at":"2021-11-12T13:09:32.669+08:00"},{"id":6435421,"file_name":"timesup.png","project_id":313119,"asset_id":322157,"created_at":"2021-11-12T13:09:32.670+08:00","updated_at":"2021-11-12T13:09:32.670+08:00"},{"id":6435422,"file_name":"item_4.png","project_id":313119,"asset_id":322154,"created_at":"2021-11-12T13:09:32.671+08:00","updated_at":"2021-11-12T13:09:32.671+08:00"},{"id":6435423,"file_name":"p_2.png","project_id":313119,"asset_id":323745,"created_at":"2021-11-12T13:09:32.672+08:00","updated_at":"2021-11-12T13:09:32.672+08:00"},{"id":6435424,"file_name":"p_0.png","project_id":313119,"asset_id":323746,"created_at":"2021-11-12T13:09:32.673+08:00","updated_at":"2021-11-12T13:09:32.673+08:00"},{"id":6435425,"file_name":"p_1.png","project_id":313119,"asset_id":323747,"created_at":"2021-11-12T13:09:32.674+08:00","updated_at":"2021-11-12T13:09:32.674+08:00"},{"id":6435426,"file_name":"bg_0.png","project_id":313119,"asset_id":323748,"created_at":"2021-11-12T13:09:32.675+08:00","updated_at":"2021-11-12T13:09:32.675+08:00"},{"id":6435427,"file_name":"infoo.png","project_id":313119,"asset_id":322147,"created_at":"2021-11-12T13:09:32.676+08:00","updated_at":"2021-11-12T13:09:32.676+08:00"},{"id":6435428,"file_name":"god_0.png","project_id":313119,"asset_id":323750,"created_at":"2021-11-12T13:09:32.677+08:00","updated_at":"2021-11-12T13:09:32.677+08:00"},{"id":6435429,"file_name":"god_2.png","project_id":313119,"asset_id":323752,"created_at":"2021-11-12T13:09:32.678+08:00","updated_at":"2021-11-12T13:09:32.678+08:00"},{"id":6435430,"file_name":"item_0.png","project_id":313119,"asset_id":322153,"created_at":"2021-11-12T13:09:32.679+08:00","updated_at":"2021-11-12T13:09:32.679+08:00"},{"id":6435431,"file_name":"item_2.png","project_id":313119,"asset_id":322158,"created_at":"2021-11-12T13:09:32.680+08:00","updated_at":"2021-11-12T13:09:32.680+08:00"},{"id":6435432,"file_name":"devil.png","project_id":313119,"asset_id":323753,"created_at":"2021-11-12T13:09:32.681+08:00","updated_at":"2021-11-12T13:09:32.681+08:00"},{"id":6435433,"file_name":"god_1.png","project_id":313119,"asset_id":323754,"created_at":"2021-11-12T13:09:32.682+08:00","updated_at":"2021-11-12T13:09:32.682+08:00"},{"id":6435434,"file_name":"bg_1.png","project_id":313119,"asset_id":323946,"created_at":"2021-11-12T13:09:32.683+08:00","updated_at":"2021-11-12T13:09:32.683+08:00"},{"id":6435435,"file_name":"p_3.png","project_id":313119,"asset_id":323947,"created_at":"2021-11-12T13:09:32.683+08:00","updated_at":"2021-11-12T13:09:32.683+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦