{"id":229088,"student_id":10,"content":"Game.set({width: 1200, height: 900})\n\nvar bg1 = createSprite(\"bg_3.png\");\nvar bg2 = createSprite(\"bg_2.png\");\nvar bg3 = createSprite(\"bg_1.png\");\nvar tree = createSprite(\"tree.png\");\nvar ground = createSprite(\"ground.png\");\nvar koding = createSprite(\"koding.png\");\nvar ball = createSprite(\"ball.png\");\nvar jumper = createSprite(\"jumer.png\");\nvar tree2 = createSprite(\"tree.png\"); //示範如何新增樹,之後都列在挑戰\nvar tree3 = createSprite(\"tree.png\"); //示範如何新增樹,之後都列在挑戰\nvar hint = createSprite(\"jumer.png\");\n\nhint.opacity = 0.3;\n\nvar vy = 0;\nvar speed = 5;\nvar score = 0;\n\nkoding.scale = 0.5;\n\nkoding.rotationStyle = 'fixed';\njumper.rotationStyle = 'fixed';\ntree.rotationStyle = 'fixed';\n\nball.stepForward(-300);\nkoding.stepForward(300);\n\nfunction gameloop () {\n \n score += speed / 100;\n print('score is: ' + Math.floor(score) + 'm', 10, 10, 'black', 30);\n \n ground.direction = 90 + speed / 5;\n koding.direction = 90 + speed / 5;\n jumper.direction = 90 + speed / 5;\n tree.direction = 90 + speed / 5;\n tree2.direction = 90 + speed / 5;\n tree3.direction = 90 + speed / 5;\n\n koding.stepForward(-speed);\n jumper.stepForward(-speed);\n tree.stepForward(-speed);\n tree2.stepForward(-speed);\n tree3.stepForward(-speed);\n \n ball.direction += speed / 5;\n ball.scale = speed / 10;\n speed += 0.002;\n \n if (koding.x \u003c 0) {\n var rand = Math.random() * 500 + 1200;\n koding.stepForward(rand);\n }\n \n if (tree.x \u003c 0) {\n var rand = Math.random() * 500 + 1200;\n tree.stepForward(rand);\n tree.scale = Math.random() * 0.5 + 0.5;\n }\n \n if (tree2.x \u003c 0) {\n var rand = Math.random() * 500 + 1200;\n tree2.stepForward(rand);\n tree2.scale = Math.random() * 0.5 + 0.5;\n }\n \n if (tree3.x \u003c 0) {\n var rand = Math.random() * 500 + 1200;\n tree3.stepForward(rand);\n tree3.scale = Math.random() * 0.5 + 0.5;\n }\n \n if (jumper.touched(ball)) vy = 10;\n \n if (!ball.touched(ground) || vy \u003e 0) {\n ball.y -= vy;\n }\n vy -= 0.2;\n \n hint.x = cursor.x;\n hint.y = cursor.y;\n hint.hidden = jumper.x \u003e 0;\n \n updateBackground();\n}\n\nfunction setJumper () {\n if (jumper.x \u003c 0 \u0026\u0026 ground.touched(hint)) {\n jumper.x = cursor.x;\n jumper.y = cursor.y; \n }\n}\n\nfunction updateBackground () {\n bg1.x -= 0.1;\n bg2.x -= 0.2;\n bg3.x -= 0.3;\n if (bg1.x \u003c 0) bg1.x += 1200;\n if (bg2.x \u003c 0) bg2.x += 1200;\n if (bg3.x \u003c 0) bg3.x += 1200;\n}\n\nforever(gameloop);\non('click', setJumper);","created_at":"2021-02-18T14:55:12.973+08:00","updated_at":"2021-03-18T15:41:42.170+08:00","name":"snowball","language":"javascript","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/229088/29a71e31c62c5cdede24c9f77b5b4e3b.jpg"},"parent_id":2,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":210,"hashid":"kdms68n3r","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":4097736,"file_name":"koding.png","project_id":229088,"asset_id":318431,"created_at":"2021-02-18T16:25:31.216+08:00","updated_at":"2021-02-18T16:25:31.216+08:00"},{"id":4097737,"file_name":"ball.png","project_id":229088,"asset_id":318432,"created_at":"2021-02-18T16:29:34.731+08:00","updated_at":"2021-02-18T16:29:34.731+08:00"},{"id":4097602,"file_name":"ground.png","project_id":229088,"asset_id":318428,"created_at":"2021-02-18T14:55:50.144+08:00","updated_at":"2021-02-18T14:55:50.144+08:00"},{"id":4097603,"file_name":"tree.png","project_id":229088,"asset_id":318429,"created_at":"2021-02-18T14:55:50.146+08:00","updated_at":"2021-02-18T14:55:50.146+08:00"},{"id":4097599,"file_name":"bg_1.png","project_id":229088,"asset_id":318425,"created_at":"2021-02-18T14:55:48.468+08:00","updated_at":"2021-02-18T14:55:48.468+08:00"},{"id":4097600,"file_name":"bg_2.png","project_id":229088,"asset_id":318426,"created_at":"2021-02-18T14:55:49.485+08:00","updated_at":"2021-02-18T14:55:49.485+08:00"},{"id":4097601,"file_name":"bg_3.png","project_id":229088,"asset_id":318427,"created_at":"2021-02-18T14:55:49.487+08:00","updated_at":"2021-02-18T14:55:49.487+08:00"},{"id":4097735,"file_name":"jumer.png","project_id":229088,"asset_id":318430,"created_at":"2021-02-18T15:58:11.177+08:00","updated_at":"2021-02-18T16:00:21.649+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
下載 Android APP (APK)
截圖
1:1:1
1:1
full
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦