{"id":229192,"student_id":10,"content":"Game.set({ width: 1200, height: 900 })\nlet player = createSprite(\"p_0.png\", \"p_1.png\", \"p_1.png\");\nlet enemy_a = createSprite(\"a_0.png\", \"a_1.png\", \"a_1.png\"); // 挑戰者A\nlet enemy_a_fake = createSprite(\"a_2.png\"); // 挑戰者A的屍體\nlet enemy_b = createSprite(\"b_0.png\", \"b_1.png\", \"b_1.png\"); // 挑戰者B\nlet enemy_b_fake = createSprite(\"b_2.png\"); // 挑戰者B的屍體\nlet enemy_c = createSprite(\"c_0.png\", \"c_1.png\", \"c_1.png\"); // 挑戰者C\nlet enemy_c_fake = createSprite(\"c_2.png\"); // 挑戰者C的屍體\n\nlet power = 0;\nlet status = 0;\nlet speed = 0;\nlet life = 3;\n\nplayer.x = 200;\nenemy_a.x = 1200;\nenemy_b.x = 1500;\nenemy_c.x = 1800;\n\nfunction gameloop () {\n moveEnemies();\n updateEnemy(enemy_a, enemy_a_fake);\n updateEnemy(enemy_b, enemy_b_fake);\n updateEnemy(enemy_c, enemy_c_fake);\n updateFakes();\n \n print('life: ' + life, 10, 10, 'black', 20);\n}\n\nfunction moveEnemies () {\n enemy_a.x -= 7;\n enemy_b.x -= 7;\n enemy_c.x -= 7;\n \n if (enemy_b.x \u003e 600) enemy_b.x -= 3;\n if (enemy_c.x \u003e 600 \u0026\u0026 enemy_c.x \u003c 700) enemy_b.x += 3;\n}\n\nfunction updateEnemy (enemy, enemyFake) {\n \n if (enemy.x \u003c 0) {\n enemy.x = 1200 + Math.random() * 600;\n enemy.hidden = false;\n enemy.costumeId = 0;\n }\n \n if (enemy.costumeId != 2) {\n enemy.costumeId = Math.floor(enemy.x / 50) % 2;\n }\n \n // suck\n if (enemy.x \u003c player.x \u0026\u0026 enemy.hidden == false \u0026\u0026 enemy.costumeId != 2) {\n enemy.costumeId = 2;\n life -= 1;\n }\n \n if (player.touched(enemy) == true) {\n if (enemy.x \u003e player.x \u0026\u0026 cursor.isDown) {\n enemyFake.moveTo(enemy);\n enemy.hidden = true;\n } \n }\n}\n\nfunction updateFakes () {\n enemy_a_fake.move(30, -10);\n enemy_b_fake.move(30, -10);\n enemy_c_fake.move(30, -10);\n enemy_a_fake.direction -= 20;\n enemy_b_fake.direction -= 20;\n enemy_c_fake.direction -= 20;\n}\n\nforever(gameloop);\n","created_at":"2021-02-19T16:21:05.246+08:00","updated_at":"2021-03-17T16:38:12.051+08:00","name":"挑戰賽","language":"javascript","screenshot":{"url":"https://cdn0.koding.school/uploads/project/screenshot/229192/55c427392fb7f6b89a00ba8ab7f7c12e.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":197,"hashid":"wdks4w26d","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4099723,"file_name":"b_0.png","project_id":229192,"asset_id":318493,"created_at":"2021-02-19T17:11:59.758+08:00","updated_at":"2021-02-19T17:11:59.758+08:00"},{"id":4099724,"file_name":"b_1.png","project_id":229192,"asset_id":318494,"created_at":"2021-02-19T17:11:59.759+08:00","updated_at":"2021-02-19T17:11:59.759+08:00"},{"id":4099725,"file_name":"c_0.png","project_id":229192,"asset_id":318495,"created_at":"2021-02-19T17:12:00.666+08:00","updated_at":"2021-02-19T17:12:00.666+08:00"},{"id":4099726,"file_name":"c_1.png","project_id":229192,"asset_id":318496,"created_at":"2021-02-19T17:12:00.668+08:00","updated_at":"2021-02-19T17:12:00.668+08:00"},{"id":4099727,"file_name":"d_0.png","project_id":229192,"asset_id":318497,"created_at":"2021-02-19T17:12:01.559+08:00","updated_at":"2021-02-19T17:12:01.559+08:00"},{"id":4099728,"file_name":"d_1.png","project_id":229192,"asset_id":318498,"created_at":"2021-02-19T17:12:01.561+08:00","updated_at":"2021-02-19T17:12:01.561+08:00"},{"id":4099721,"file_name":"a_0.png","project_id":229192,"asset_id":318491,"created_at":"2021-02-19T17:11:57.731+08:00","updated_at":"2021-02-19T17:11:57.731+08:00"},{"id":4099722,"file_name":"a_1.png","project_id":229192,"asset_id":318492,"created_at":"2021-02-19T17:11:57.733+08:00","updated_at":"2021-02-19T17:11:57.733+08:00"},{"id":4099731,"file_name":"c_2.png","project_id":229192,"asset_id":318501,"created_at":"2021-02-19T17:13:24.632+08:00","updated_at":"2021-02-19T17:13:24.632+08:00"},{"id":4099732,"file_name":"d_2.png","project_id":229192,"asset_id":318502,"created_at":"2021-02-19T17:13:24.634+08:00","updated_at":"2021-02-19T17:13:24.634+08:00"},{"id":4099729,"file_name":"a_2.png","project_id":229192,"asset_id":318499,"created_at":"2021-02-19T17:13:20.397+08:00","updated_at":"2021-02-19T17:13:20.397+08:00"},{"id":4099730,"file_name":"b_2.png","project_id":229192,"asset_id":318500,"created_at":"2021-02-19T17:13:20.399+08:00","updated_at":"2021-02-19T17:13:20.399+08:00"},{"id":4099525,"file_name":"p_0.png","project_id":229192,"asset_id":318490,"created_at":"2021-02-19T16:21:35.165+08:00","updated_at":"2021-02-19T16:21:45.356+08:00"},{"id":4099524,"file_name":"p_1.png","project_id":229192,"asset_id":318489,"created_at":"2021-02-19T16:21:35.163+08:00","updated_at":"2021-02-19T16:21:47.904+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦