{"id":12614,"student_id":104,"content":"var dinosaur = createSprite([\"left.png\", \"right.png\", \"idle.png\"]);\r\nvar cactus = createSprite([\"thing.png\", \"thing2.png\", \"thing3.png\", \"thing4.png\"]);\r\nvar score = 0;\r\ndinosaur.x = 40;\r\ndinosaur.y = 200;\r\ndinosaur.v = 0; // v 代表為垂直的速度 ex: 小恐龍跳起來的時候,一開始跳起的瞬間,速度最快;到達高度的頂點時,速度最慢;落下時速度加快。\r\ncactus.x = 660;\r\ncactus.y = 210;\r\nforever(function(){\r\n cactus.x -= 5;\r\n if(cactus.x \u003c -40){\r\n cactus.x = 660;\r\n cactus.costumeId = Math.floor(Math.random()*4);\r\n }\r\n\r\n if (dinosaur.y \u003c 40){\r\n dinosaur.v = 5;\r\n } else if (dinosaur.y \u003e 200){\r\n dinosaur.v = 0;\r\n dinosaur.y = 200;\r\n }\r\n\r\n dinosaur.y = dinosaur.y + dinosaur.v;\r\n // cactus.x = cactus.x -5 - (score / 50);\r\n print(\"Score: \" + score);\r\n});\r\n//小恐龍走路動畫,邊走路邊增加分數\r\nsetInterval( //使用 setInterval 執行每隔一段時間執行某段程式碼\r\n function(){\r\n if (dinosaur.touched(ground)) {\r\n dinosaur.animate([0,1]); // 改變 0 跟 1 的圖\r\n }\r\n score += 1; \r\n }, 500);\r\n//按下空白鍵,小恐龍跳起來\r\nwhen(\"keydown\", \"space\",function(){\r\n if (dinosaur.touched(ground)){\r\n dinosaur.v -= 5;\r\n }\r\n});\r\n//小恐龍撞到仙人掌遊戲失敗\r\ndinosaur.when(\"touch\", cactus, function(){\r\n dinosaur.costumeId = 2;\r\n stop();\r\n});","created_at":"2017-09-22T11:33:28.312+08:00","updated_at":"2019-10-07T01:40:29.674+08:00","name":"小恐龍跑酷 (學生版)","language":"javascript","screenshot":{"url":"https://cdn9.koding.school/uploads/project/screenshot/12614/b6a16adf5a273a529b5f62fbb0b8de9d.jpg"},"parent_id":11650,"plugin":"\n\nvar ground = createSprite('ground.jpg');\nground.y = 480;","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":135,"hashid":"p93skmy6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":267077,"file_name":"cloud.png","project_id":12614,"asset_id":30801,"created_at":"2017-10-10T18:12:30.474+08:00","updated_at":"2017-10-10T18:12:30.474+08:00"},{"id":267078,"file_name":"ground.jpg","project_id":12614,"asset_id":30802,"created_at":"2017-10-10T18:12:30.480+08:00","updated_at":"2017-10-10T18:12:30.480+08:00"},{"id":267079,"file_name":"idle.png","project_id":12614,"asset_id":30803,"created_at":"2017-10-10T18:12:30.484+08:00","updated_at":"2017-10-10T18:12:30.484+08:00"},{"id":267080,"file_name":"left.png","project_id":12614,"asset_id":30804,"created_at":"2017-10-10T18:12:30.487+08:00","updated_at":"2017-10-10T18:12:30.487+08:00"},{"id":267081,"file_name":"right.png","project_id":12614,"asset_id":30805,"created_at":"2017-10-10T18:12:30.491+08:00","updated_at":"2017-10-10T18:12:30.491+08:00"},{"id":267082,"file_name":"thing.png","project_id":12614,"asset_id":30806,"created_at":"2017-10-10T18:12:30.496+08:00","updated_at":"2017-10-10T18:12:30.496+08:00"},{"id":267083,"file_name":"thing2.png","project_id":12614,"asset_id":30807,"created_at":"2017-10-10T18:12:30.501+08:00","updated_at":"2017-10-10T18:12:30.501+08:00"},{"id":267084,"file_name":"thing3.png","project_id":12614,"asset_id":30808,"created_at":"2017-10-10T18:12:30.505+08:00","updated_at":"2017-10-10T18:12:30.505+08:00"},{"id":267085,"file_name":"thing4.png","project_id":12614,"asset_id":30809,"created_at":"2017-10-10T18:12:30.510+08:00","updated_at":"2017-10-10T18:12:30.510+08:00"},{"id":267086,"file_name":"back.001.png","project_id":12614,"asset_id":30810,"created_at":"2017-10-10T18:12:30.516+08:00","updated_at":"2017-10-10T18:12:30.516+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦