{"id":229160,"student_id":10,"content":"// 修改方向\n// 目前遊戲太過複雜,要簡化遊戲情境和程式\n// 改為\n// 叩叮背著釣竿拿著魚會從下方經過,玩家是一隻小偷烏鴉,要下去偷魚然後放在最上面的鳥巢\n// 中間會不斷有飛鳥經過,如果碰到魚就會被搶走\n// 簡化方向:\n// 1. 不需要有各種類型的鳥(但會有不同速度?還是要用造型來判斷?)\n// 2. 玩家只能偷魚\n// 3. 改為限制遊戲時間\n// 4. 模仿青蛙過河,鳥只會水平移動而且不會隨機切換高度\n// 5. 有兩種方向移動,交錯,用兩個函式,往左移動和往右移動\n// 6. 增加鳥到 6 隻或更多(挑戰?)\n\n\nsetBackdrop(\"bg.png\");\n\nvar player = createSprite(\"crow_0.png\", \"crow_1.png\", \"crow_2.png\", \"crow_3.png\", \"crrow_4.png\");\nvar koding = createSprite(\"koding_0.png\", \"koding_1.png\", \"koding_2.png\", \"koding_3.png\", \"koding_4.png\", \"koding_5.png\", \"koding_6.png\", \"koding_7.png\", \"koding_8.png\", \"koding_9.png\", \"koding_10.png\", \"koding_11.png\");\nvar nest = createSprite(\"nest.png\");\nvar bird_1 = createSprite(\"bird_0.png\", \"bird_1.png\", \"bird_2.png\", \"bird_3.png\", \"bird_4.png\");\nvar bird_2 = createSprite(\"bird_0.png\", \"bird_1.png\", \"bird_2.png\", \"bird_3.png\", \"bird_4.png\");\nvar bird_3 = createSprite(\"bird_0.png\", \"bird_1.png\", \"bird_2.png\", \"bird_3.png\", \"bird_4.png\");\nvar dog = createSprite(\"dog0.png\", \"dog1.png\");\n\nvar clock = 0;\nvar timer = 0;\nvar life = 5;\nvar score = 0;\n\nvar birds = [bird_1, bird_2, bird_3];\n\nbird_1.x = 1200;\nbird_2.x = 1200 + 800;\nbird_3.x = 1200 + 1600;\nbird_1.y = 200;\nbird_2.y = 400;\nbird_3.y = 600;\nnest.x = 150;\nnest.y = 150;\nkoding.y = 750;\ndog.y = 750;\nplayer.rotationStyle = 'flipped';\n\nfunction gameloop () {\n updatePlayer(); //更新玩家\n updateKoding(); //更新叩叮\n updateBird(bird_1); //更新鳥1位置\n updateBird(bird_2); //更新鳥2位置\n updateBird(bird_3); //更新鳥3位置\n touchDetect(); //碰撞偵測\n updateDog(); //更新狗的位置\n updateKodingCostume(); //更新叩叮造型\n updateInfos(); //更新分數和血量\n}\n\nfunction updateInfos () {\n drawText('score:' + score, 10, 10, 'black', 30);\n drawText('life:' + life, 10, 40, 'black', 30);\n}\n\nfunction updatePlayer () {\n if (key.right) {\n player.x += 3;\n player.direction = 90;\n }\n if (key.left) {\n player.x -= 3;\n player.direction = 270;\n }\n if (key.up) {\n player.y -= 3;\n }\n else {\n player.y += 3;\n }\n \n if (player.y \u003e 800) player.y = 800;\n if (player.costumeId != 0) player.y += 1.5;\n \n if (timer \u003e clock) {\n if (clock % 20 \u003e 10) {\n player.opacity = 0.5;\n } else {\n player.opacity = 1;\n }\n } else {\n player.opacity = 1;\n }\n}\n\nfunction updateKoding () {\n if (player.costumeId == 0) koding.x -= 3;\n if (koding.x \u003c 0) {\n koding.x += 1200 + Math.random() * 1200; \n koding.costumeId = Math.floor(Math.random()*5) + 1;\n }\n}\n\nfunction touchDetect () {\n if (player.touched(koding) == true \u0026\u0026 player.costumeId == 0) {\n var costumeId = koding.costumeId % 6;\n if (costumeId != 5) {\n koding.costumeId = 0;\n player.costumeId = costumeId;\n } else {\n koding.costumeId = 0;\n }\n \n }\n \n if (player.touched(nest) == true) {\n koding.costumeId = 0;\n player.costumeId = 0;\n }\n \n if (player.touched(birds) == true \u0026\u0026 timer \u003c clock) {\n timer = clock + 120;\n life -= 1;\n }\n \n if (player.touched(dog) == true \u0026\u0026 timer \u003c clock) {\n timer = clock + 120;\n life -= 1;\n }\n \n if (life \u003c= 0) {\n stop();\n }\n}\n\n\nfunction updateBird (bird) {\n bird.x -= 8;\n if (bird.x \u003c 0) {\n bird.x += 1200 + Math.random() * 300;\n bird.y = Math.random() * 800;\n bird.costumeId = Math.floor(Math.random() * 5);\n }\n}\n\nfunction updateDog () {\n dog.x += 10;\n if (dog.x \u003e 1200) {\n dog.x = -1200 - Math.random() * 1000;\n }\n dog.costumeId = Math.abs(Math.floor(dog.x / 50) % 2);\n}\n\nfunction updateKodingCostume () {\n clock++;\n if (clock % 20 == 0) {\n if (player.costumeId != 0) {\n koding.costumeId = 0;\n }\n else if (koding.costumeId \u003e 5) {\n koding.costumeId -= 6;\n }\n else {\n koding.costumeId += 6;\n }\n }\n}\n\nforever(gameloop);","created_at":"2021-02-19T11:10:01.540+08:00","updated_at":"2021-02-22T18:56:05.371+08:00","name":"邪惡烏鴉","language":"javascript","screenshot":{"url":"/uploads/project/screenshot/229160/e3807556bd8a5f4771f12b80d70b8cdd.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":386,"hashid":"yeysvgjk2","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4099225,"file_name":"dog1.png","project_id":229160,"asset_id":318477,"created_at":"2021-02-19T13:35:27.757+08:00","updated_at":"2021-02-19T13:35:27.757+08:00"},{"id":4099190,"file_name":"nest.png","project_id":229160,"asset_id":318450,"created_at":"2021-02-19T11:31:52.759+08:00","updated_at":"2021-02-19T11:31:52.759+08:00"},{"id":4099188,"file_name":"bg.png","project_id":229160,"asset_id":318448,"created_at":"2021-02-19T11:25:18.659+08:00","updated_at":"2021-02-19T11:25:18.659+08:00"},{"id":4099187,"file_name":"bird.png","project_id":229160,"asset_id":318447,"created_at":"2021-02-19T11:13:33.199+08:00","updated_at":"2021-02-19T11:13:33.199+08:00"},{"id":4099189,"file_name":"koding.png","project_id":229160,"asset_id":318449,"created_at":"2021-02-19T11:26:21.353+08:00","updated_at":"2021-02-19T11:26:21.353+08:00"},{"id":4099224,"file_name":"dog0.png","project_id":229160,"asset_id":318476,"created_at":"2021-02-19T13:35:27.756+08:00","updated_at":"2021-02-19T13:35:39.105+08:00"},{"id":4136875,"file_name":"koding_8.png","project_id":229160,"asset_id":319877,"created_at":"2021-02-22T17:04:24.176+08:00","updated_at":"2021-02-22T17:04:24.176+08:00"},{"id":4136876,"file_name":"koding_9.png","project_id":229160,"asset_id":319878,"created_at":"2021-02-22T17:04:24.177+08:00","updated_at":"2021-02-22T17:04:24.177+08:00"},{"id":4136689,"file_name":"bird_2.png","project_id":229160,"asset_id":319861,"created_at":"2021-02-22T16:08:35.401+08:00","updated_at":"2021-02-22T16:08:35.401+08:00"},{"id":4136690,"file_name":"bird_3.png","project_id":229160,"asset_id":319862,"created_at":"2021-02-22T16:08:35.402+08:00","updated_at":"2021-02-22T16:08:35.402+08:00"},{"id":4136862,"file_name":"crow_0.png","project_id":229160,"asset_id":319864,"created_at":"2021-02-22T17:04:19.646+08:00","updated_at":"2021-02-22T17:04:19.646+08:00"},{"id":4136867,"file_name":"koding_0.png","project_id":229160,"asset_id":319869,"created_at":"2021-02-22T17:04:21.652+08:00","updated_at":"2021-02-22T17:04:21.652+08:00"},{"id":4136868,"file_name":"koding_1.png","project_id":229160,"asset_id":319870,"created_at":"2021-02-22T17:04:21.654+08:00","updated_at":"2021-02-22T17:04:21.654+08:00"},{"id":4136861,"file_name":"crrow_4.png","project_id":229160,"asset_id":319863,"created_at":"2021-02-22T17:04:19.645+08:00","updated_at":"2021-02-22T17:10:45.877+08:00"},{"id":4136863,"file_name":"crow_1.png","project_id":229160,"asset_id":319865,"created_at":"2021-02-22T17:04:20.475+08:00","updated_at":"2021-02-22T17:04:20.475+08:00"},{"id":4136864,"file_name":"crow_2.png","project_id":229160,"asset_id":319866,"created_at":"2021-02-22T17:04:20.476+08:00","updated_at":"2021-02-22T17:04:20.476+08:00"},{"id":4136877,"file_name":"koding_10.png","project_id":229160,"asset_id":319879,"created_at":"2021-02-22T17:04:24.799+08:00","updated_at":"2021-02-22T17:04:24.799+08:00"},{"id":4136878,"file_name":"koding_11.png","project_id":229160,"asset_id":319880,"created_at":"2021-02-22T17:04:24.800+08:00","updated_at":"2021-02-22T17:04:24.800+08:00"},{"id":4136871,"file_name":"koding_4.png","project_id":229160,"asset_id":319873,"created_at":"2021-02-22T17:04:22.942+08:00","updated_at":"2021-02-22T17:04:22.942+08:00"},{"id":4136872,"file_name":"koding_5.png","project_id":229160,"asset_id":319874,"created_at":"2021-02-22T17:04:22.944+08:00","updated_at":"2021-02-22T17:04:22.944+08:00"},{"id":4136687,"file_name":"bird_0.png","project_id":229160,"asset_id":319859,"created_at":"2021-02-22T16:08:34.860+08:00","updated_at":"2021-02-22T16:08:34.860+08:00"},{"id":4136688,"file_name":"bird_1.png","project_id":229160,"asset_id":319860,"created_at":"2021-02-22T16:08:34.862+08:00","updated_at":"2021-02-22T16:08:34.862+08:00"},{"id":4136686,"file_name":"bird_4.png","project_id":229160,"asset_id":319858,"created_at":"2021-02-22T16:04:12.637+08:00","updated_at":"2021-02-22T16:04:12.637+08:00"},{"id":4136873,"file_name":"koding_6.png","project_id":229160,"asset_id":319875,"created_at":"2021-02-22T17:04:23.568+08:00","updated_at":"2021-02-22T17:04:23.568+08:00"},{"id":4136874,"file_name":"koding_7.png","project_id":229160,"asset_id":319876,"created_at":"2021-02-22T17:04:23.569+08:00","updated_at":"2021-02-22T17:04:23.569+08:00"},{"id":4136865,"file_name":"crow_3.png","project_id":229160,"asset_id":319867,"created_at":"2021-02-22T17:04:21.054+08:00","updated_at":"2021-02-22T17:04:21.054+08:00"},{"id":4136866,"file_name":"crow_5.png","project_id":229160,"asset_id":319868,"created_at":"2021-02-22T17:04:21.056+08:00","updated_at":"2021-02-22T17:04:21.056+08:00"},{"id":4136869,"file_name":"koding_2.png","project_id":229160,"asset_id":319871,"created_at":"2021-02-22T17:04:22.283+08:00","updated_at":"2021-02-22T17:04:22.283+08:00"},{"id":4136870,"file_name":"koding_3.png","project_id":229160,"asset_id":319872,"created_at":"2021-02-22T17:04:22.284+08:00","updated_at":"2021-02-22T17:04:22.284+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