{"id":291830,"student_id":2589,"content":"import game\nimport random\nimport time\n\nbg_1 = game.create_sprite('bg_1.png')\nbg_2 = game.create_sprite('bg_2.png')\ntarget = game.create_sprite('target.png')\nreward = game.create_sprite('r0.png','r1.png','r2.png','r3.png','r4.png','r5.png','r6.png','r7.png','r8.png','r9.png','r10.png')\nnumber = game.create_sprite('n0.png','n1.png','n2.png','n3.png','n4.png','n5.png')\ngame.create_sound('bgm.mp3')\n\nnumber.opacity = 0.7\nbg_1.layer = 1\nnumber.layer = 2\ntarget.layer = 3\nreward.layer = 4\nreward.hidden = True\nnumber.hidden = True\n\nclock = 0\nscores = 0\nballoons = []\nendTime = time.time() + 10\n\ndef loop ():\n global clock, scores, endTime\n \n target.x = cursor.x\n target.y = cursor.y\n\n clock += 1\n if clock%10 == 0:\n b = game.create_sprite('a.png', 'b.png', 'c.png', 'd.png', 'e.png', 'g.png', 'f.png')\n rand = random.randint(0, 6)\n if rand == 0:\n b.costume_id = 0\n elif rand == 1:\n b.costume_id = 1\n elif rand == 2:\n b.costume_id = 2\n elif rand == 3:\n b.costume_id = 3\n elif rand == 4:\n b.costume_id = 4\n elif rand == 5:\n b.costume_id = 5\n else:\n b.costume_id = 6\n b.y = 1000\n b.x = random.random()*1000 + 100\n balloons.append(b)\n \n for b in balloons:\n if b.costume_id == 0:\n b.y -= 3\n if b.costume_id == 1:\n b.y -= 5\n if b.costume_id == 2:\n b.y -= 7\n if b.costume_id == 3:\n b.y -= 8\n if b.costume_id == 4:\n b.y -= 8\n if b.costume_id == 5:\n b.y -= 7\n if b.costume_id == 6:\n b.y -= 6\n\n if cursor.is_down and b.touched(cursor):\n if b.costume_id == 0:\n scores += 1 \n if b.costume_id == 1:\n scores += 10 \n if b.costume_id == 2:\n scores += 5 \n if b.costume_id == 3:\n scores *= 2 \n if b.costume_id == 4:\n scores /= 2 \n if b.costume_id == 5:\n endTime += 3\n if b.costume_id == 6:\n endTime = time.time() \n b.destroy()\n \n game.create_sound('shot.mp3')\n \n game.draw_text(scores, 60, 20, 'white', 40)\n\n t = endTime - time.time()\n if t \u003c= 5:\n number.hidden = False\n else:\n number.hidden = True\n if t \u003c= 0:\n number.costume_id = 0\n elif t \u003c= 1:\n number.costume_id = 1\n elif t \u003c= 2:\n number.costume_id = 2\n elif t \u003c= 3:\n number.costume_id = 3\n elif t \u003c= 4:\n number.costume_id = 4\n elif t \u003c= 5:\n number.costume_id = 5\n \n if t \u003c= 0:\n reward.hidden = False\n if scores \u003e 10000000000:\n reward.costume_id = 0\n elif scores \u003e 1000000000:\n reward.costume_id = 1\n elif scores \u003e 100000000:\n reward.costume_id = 2\n elif scores \u003e 10000000:\n reward.costume_id = 3\n elif scores \u003e 1000000:\n reward.costume_id = 4\n elif scores \u003e 100000:\n reward.costume_id = 5\n elif scores \u003e 10000:\n reward.costume_id = 6\n elif scores \u003e 1000:\n reward.costume_id = 7\n elif scores \u003e 100:\n reward.costume_id = 8\n elif scores \u003e 10:\n reward.costume_id = 9\n else:\n reward.costume_id = 10\n game.stop()\n \ngame.forever(loop)","created_at":"2021-08-25T19:50:42.287+08:00","updated_at":"2021-08-25T19:50:48.492+08:00","name":"123","language":"python","screenshot":{"url":null},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":67,"hashid":"kdms6ddnp","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":5827077,"file_name":"bg.jpg","project_id":291830,"asset_id":302344,"created_at":"2021-08-25T19:50:42.294+08:00","updated_at":"2021-08-25T19:50:42.294+08:00"},{"id":5827075,"file_name":"koding.png","project_id":291830,"asset_id":302346,"created_at":"2021-08-25T19:50:42.292+08:00","updated_at":"2021-08-25T19:50:42.292+08:00"},{"id":5827076,"file_name":"calm.mp3","project_id":291830,"asset_id":302345,"created_at":"2021-08-25T19:50:42.293+08:00","updated_at":"2021-08-25T19:50:42.293+08:00"},{"id":5827078,"file_name":"cloud.png","project_id":291830,"asset_id":302343,"created_at":"2021-08-25T19:50:42.295+08:00","updated_at":"2021-08-25T19:50:42.295+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦