{"id":63750,"student_id":70,"content":"# 引入遊戲模組:\nimport game\nimport random\n\nEXAM_TIME = 400\nDIFFUSION_TIME = 200\nN = 100\n\nparticles = []\ncollisions = 0\ntime = 0\n\nbump = game.createSprite(\"bump.png\")\nbump.size = 2\nbump.y = 120 # 可試試 240, 360 的差別\n\n\nfor i in range(0,N):\n particle = game.createSprite(\"particle.png\")\n particle.y = 400\n particle.direction = random.random()*360\n particle.life = 0\n particles.append(particle)\n\ndef update():\n global collisions, time\n \n time += 1\n if time\u003e=DIFFUSION_TIME+EXAM_TIME:\n game.stop()\n \n for p in particles:\n if p.life%4==0:\n p.direction += 90 - random.random()*180\n # 可試試不同的速度 (2, 4, 8, 12 ... etc)\n p.stepForward(4)\n p.life += 1\n if p.touched(bump):\n p.direction -= 180\n p.y += 4\n if time\u003e=DIFFUSION_TIME:\n collisions += 1\n p.bounceEdge()\n \n game.print(\"Collisions: \"+str(collisions),20,20) \n game.print(\"經過時間: \"+str(time),20,40) \n\n# 重複不斷執行 update 函式:\ngame.forever(update)\n\n","created_at":"2019-04-22T14:01:41.305+08:00","updated_at":"2021-10-15T20:03:51.843+08:00","name":"波以爾定律","language":"python","screenshot":{"url":"https://cdn3.koding.school/uploads/project/screenshot/63750/9a2602154c461dab9ff9c73cf51c9a62.jpg"},"parent_id":4,"plugin":"game.set({\n \"width\": 640,\n \"height\": 480\n});","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":250,"hashid":"meysqdzj","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":1118517,"file_name":"calm.mp3","project_id":63750,"asset_id":107448,"created_at":"2019-04-22T14:01:41.310+08:00","updated_at":"2019-04-22T14:01:41.310+08:00"},{"id":1118518,"file_name":"koding.png","project_id":63750,"asset_id":107447,"created_at":"2019-04-22T14:01:41.311+08:00","updated_at":"2019-04-22T14:01:41.311+08:00"},{"id":1118519,"file_name":"bg.jpg","project_id":63750,"asset_id":107446,"created_at":"2019-04-22T14:01:41.312+08:00","updated_at":"2019-04-22T14:01:41.312+08:00"},{"id":1118520,"file_name":"cloud.png","project_id":63750,"asset_id":107445,"created_at":"2019-04-22T14:01:41.313+08:00","updated_at":"2019-04-22T14:01:41.313+08:00"},{"id":1118522,"file_name":"particle.png","project_id":63750,"asset_id":115758,"created_at":"2019-04-22T14:08:38.706+08:00","updated_at":"2019-04-22T14:08:38.706+08:00"},{"id":1118523,"file_name":"bump.png","project_id":63750,"asset_id":115759,"created_at":"2019-04-22T14:14:48.588+08:00","updated_at":"2019-04-22T14:14:48.588+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦