{"id":194301,"student_id":2589,"content":"setBackdrop(\"tutorial.png\");\nsound.play(\"bgm.mp3\");\n\nvar startBtn = createSprite(\"startBtn.png\");\nstartBtn.on('click', start);\n\nvar startTime, leftTime;\nvar clock = 0;\nvar points = 0;\nvar score = 0;\n\nvar target = createSprite(\"target.png\");\ntarget.y = 300;\ntarget.hidden = true;\n\nvar arrow = createSprite(\"arrow.png\");\narrow.y = 700;\n//arrow.layer = 1;\narrow.hidden = true;\nvar isShooting = false;\n\nvar koding = createSprite(\"koding.png\");\nkoding.y = 800;\n//koding.layer = 2;\nkoding.hidden = true;\n\nvar level = createSprite([\"f.png\", \"e.png\", \"d.png\",\n \"c.png\", \"b.png\", \"a.png\", \"s.png\"]);\nlevel.x = 900; level.y = 600;\nlevel.hidden = true;\n\n//點擊start開始遊戲\nfunction start() {\n target.hidden = false;\n koding.hidden = false;\n setBackdrop(\"range.jpg\");\n startTime = Date.now();\n}\n\non('click', shoot);\n\n//遊戲中點擊畫面射箭\nfunction shoot() {\n //console.log(\"clicked\");\n if(startBtn.hidden == false \u0026\u0026 koding.hidden == false){\n //console.log(\"hi\");\n startBtn.hidden = true;\n }\n else if (startBtn.hidden == true \u0026\u0026 arrow.y != 300) {\n //console.log(\"shoot\")\n isShooting = true;\n arrow.hidden = false;\n arrow.x = koding.x;\n }\n}\n\n//隨機出現的箭靶\nfunction moveTarget() {\n if (clock % 100 == 0) {\n target.x = 200 + Math.random()*800;\n target.opacity = 1;\n } else {\n target.opacity -= 0.01;\n }\n}\n\n//移動射出去的箭\nfunction moveArrow() {\n if (isShooting == true) {\n if (arrow.y \u003e 300) {\n arrow.y -= 20;\n } else {\n isShooting = false;\n countScore();\n setTimeout(ready, 400);\n }\n }\n}\n\n//箭回到待命位置\nfunction ready() {\n arrow.hidden = true;\n arrow.y = 700;\n points = 0;\n}\n\n//計算總分\nfunction countScore() {\n var distance = arrow.distanceTo(target);\n if (distance \u003c 15) {\n points = 30;\n } else if (distance \u003c 30) {\n points = 25;\n } else if (distance \u003c 45) {\n points = 20;\n } else if (distance \u003c 60) {\n points = 15;\n } else if (distance \u003c 75) {\n points = 10;\n } else if (distance \u003c 90) {\n points = 5;\n } else {\n points = -20;\n }\n score += points;\n}\n\n//顯示得分\nfunction showPoints() {\n if (points \u003e 0) {\n drawText(\"+\" + points, 850, 50, 'yellow', 50);\n } else if (points \u003c 0) {\n drawText(points, 850, 50, 'cyan', 50);\n }\n}\n\n//顯示神射手等級\nfunction showLevel() {\n if (score \u003c 0) {\n level.costumeId = 0;\n } else if (score \u003c 500) {\n level.costumeId = Math.ceil(score/100);\n } else {\n level.costumeId = 6;\n }\n}\n\n//重複不斷執行...\nforever(function() {\n koding.moveTo(cursor.x, 800);\n moveTarget();\n moveArrow();\n if (startBtn.hidden == true) {\n leftTime = 30 - Math.floor((Date.now()-startTime)/1000);\n drawText(\"Time: \" + leftTime, 300, 100, 'white', 50);\n drawText(\"Score: \" + score, 600, 100, 'white', 50);\n showPoints();\n }\n\n if (leftTime \u003c= 0) {\n stop();\n drawText(\"時間到!您的等級:\", 300, 550, 'orange', 50);\n level.hidden = false;\n showLevel();\n }\n clock += 1;\n});","created_at":"2020-09-30T13:52:05.089+08:00","updated_at":"2020-09-30T13:53:20.774+08:00","name":"Archery_T","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/194301/acad7f98c17502ebed8759cb03673a10.jpg"},"parent_id":2,"plugin":"Game.set({width: 1200, height: 900})","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":73,"hashid":"36ys6624","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":3326639,"file_name":"tutorial.png","project_id":194301,"asset_id":267037,"created_at":"2020-09-30T13:52:45.623+08:00","updated_at":"2020-09-30T13:52:45.623+08:00"},{"id":3326640,"file_name":"range.jpg","project_id":194301,"asset_id":267038,"created_at":"2020-09-30T13:52:45.630+08:00","updated_at":"2020-09-30T13:52:45.630+08:00"},{"id":3326641,"file_name":"target.png","project_id":194301,"asset_id":267039,"created_at":"2020-09-30T13:52:45.634+08:00","updated_at":"2020-09-30T13:52:45.634+08:00"},{"id":3326642,"file_name":"startBtn.png","project_id":194301,"asset_id":267040,"created_at":"2020-09-30T13:52:45.639+08:00","updated_at":"2020-09-30T13:52:45.639+08:00"},{"id":3326643,"file_name":"s.png","project_id":194301,"asset_id":267041,"created_at":"2020-09-30T13:52:45.644+08:00","updated_at":"2020-09-30T13:52:45.644+08:00"},{"id":3326644,"file_name":"koding.png","project_id":194301,"asset_id":267042,"created_at":"2020-09-30T13:52:45.648+08:00","updated_at":"2020-09-30T13:52:45.648+08:00"},{"id":3326645,"file_name":"f.png","project_id":194301,"asset_id":267043,"created_at":"2020-09-30T13:52:45.652+08:00","updated_at":"2020-09-30T13:52:45.652+08:00"},{"id":3326646,"file_name":"e.png","project_id":194301,"asset_id":267044,"created_at":"2020-09-30T13:52:45.656+08:00","updated_at":"2020-09-30T13:52:45.656+08:00"},{"id":3326647,"file_name":"d.png","project_id":194301,"asset_id":267045,"created_at":"2020-09-30T13:52:45.660+08:00","updated_at":"2020-09-30T13:52:45.660+08:00"},{"id":3326648,"file_name":"c.png","project_id":194301,"asset_id":267046,"created_at":"2020-09-30T13:52:45.664+08:00","updated_at":"2020-09-30T13:52:45.664+08:00"},{"id":3326649,"file_name":"b.png","project_id":194301,"asset_id":267047,"created_at":"2020-09-30T13:52:45.669+08:00","updated_at":"2020-09-30T13:52:45.669+08:00"},{"id":3326650,"file_name":"arrow.png","project_id":194301,"asset_id":267048,"created_at":"2020-09-30T13:52:45.673+08:00","updated_at":"2020-09-30T13:52:45.673+08:00"},{"id":3326651,"file_name":"a.png","project_id":194301,"asset_id":267049,"created_at":"2020-09-30T13:52:45.677+08:00","updated_at":"2020-09-30T13:52:45.677+08:00"},{"id":3326652,"file_name":"bgm.mp3","project_id":194301,"asset_id":267050,"created_at":"2020-09-30T13:52:45.734+08:00","updated_at":"2020-09-30T13:52:45.734+08:00"},{"id":3326653,"file_name":"target_0.png","project_id":194301,"asset_id":267051,"created_at":"2020-09-30T13:52:45.742+08:00","updated_at":"2020-09-30T13:52:45.742+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦