{"id":7987,"student_id":70,"content":"setBackdrop(\"#ffffff\");\n\n// L1 創造叩叮\nvar koding = createSprite(\"1.svg\");\nkoding.x = 320;\nkoding.y = 450,\nkoding.scale = 0.2;\nkoding.v=0;\nkoding.rotationStyle=\"flipped\";\n\nvar score=0;\nvar started=false;\nvar bells=[];\n\n// L2 創造4個鈴鐺\nfor(var i=0;i\u003c4;i++){\n var bell=createSprite(\"bell.png\");\n bell.x=Math.random()*440+100;\n bell.y=50+i*100;\n bell.scale=0.125;\n bells.push(bell);\n}\n\n// ====== 以上為初始化 ====== //\n\nforever(function(){\n // L1 轉身\n koding.toward(cursor);\n\n // L1 左右移動\n if(koding.direction\u003c180\u0026\u0026cursor.x-koding.x\u003e10){\n koding.x+=10;\n }\n if(koding.direction\u003e=180\u0026\u0026koding.x-cursor.x\u003e10){\n koding.x-=10;\n }\n\n // L2 不斷產生鈴鐺\n if(bells[bells.length-1].y\u003e=80){\n var bell=createSprite(\"bell.png\");\n bell.x=Math.random()*440+100;\n bell.y=-20;\n bell.scale=0.125;\n bells.push(bell);\n }\n\n // L1 重力加速度\n koding.v+=0.5;\n\n // L3 當叩叮到了畫面中央時,鏡頭跟著叩叮一起移動\n if(koding.y\u003c=240 \u0026\u0026 koding.v\u003c0 \u0026\u0026 started){\n for(var i=0;i\u003cbells.length;i++){\n bells[i].y-=koding.v;\n if(bells[i].y\u003e=600){\n bells[i].destroy();\n bells.splice(i,1);\n i--;\n }\n }\n } \n // L1 否則,叩叮往下掉\n else {\n koding.y+=koding.v;\n }\n // L4 如果叩叮掉到畫面底部以外,遊戲結束\n if(koding.y\u003e480){\n print(\"Game over!\",160,200,\"black\",60);\n stop();\n }\n\n // L1 如果還沒吃到第一個鈴鐺時,讓叩叮掉到地面上停止\n if(started==false \u0026\u0026 koding.y\u003e450){\n koding.v=0;\n koding.y=450;\n // 如果滑鼠被按下,跳起來\n if(cursor.isDown){\n koding.v=-15;\n }\n }\n // L5 印出分數\n print(score,20,20,\"black\");\n});\n\n// L5 碰到鈴鐺就加分,並刪除鈴鐺\nkoding.when('touch',bells,function(bell) {\n started=true;\n score++;\n bell.destroy();\n bells.splice(bells.indexOf(bell),1);\n koding.v=-15;\n});","created_at":"2017-03-01T20:52:04.729+08:00","updated_at":"2019-11-09T08:30:29.412+08:00","name":"叩叮跳鈴鐺 v2","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/7987/ea4d8563f47d338da51059f179648f03.jpg"},"parent_id":7971,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":370,"hashid":"yeys6qr","is_content_changed":null,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":175787,"file_name":"1.svg","project_id":7987,"asset_id":7,"created_at":"2017-07-21T16:46:25.210+08:00","updated_at":"2017-07-21T16:46:25.210+08:00"},{"id":175788,"file_name":"bell.png","project_id":7987,"asset_id":21447,"created_at":"2017-07-21T16:46:25.215+08:00","updated_at":"2017-07-21T16:46:25.215+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦