{"id":169411,"student_id":3232,"content":"import game\nimport random\nimport time\n\n\nend = time.time()+10\nbg_1 = game.create_sprite('bg_1.png')\nbg_2 = createSprite('bg_2.png')\n# 建立準星\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')\ntarget = game.create_sprite(\"target.png\") #創造角色\nshot = game.create_sound(\"shot.mp3\") #創造角色\nnumber.opacity = 0.7\nbg_1.layer = 1\nnumber.layer = 2\ntarget.layer = 3\nreward.layer = 4\nreward.hidden = True\nnumber.hidden = True\nclock = 0\nscores = 0\nballoons = []\nnumber.costume_id = 5\n\n\ndef loop ():\n global clock, scores, balloons, end\n \n # 準星跟著滑鼠\n target.x = cursor.x\n target.y = cursor.y\n # 建立氣球\n if clock % 10 == 0:\n balloon = game.create_sprite(\"a.png\", \"b.png\", \"c.png\", \"d.png\", \"e.png\", \"f.png\", \"g.png\")\n balloon.costume_id = random.randint(0, 6)\n balloon.x = random.randint(100, 1000)\n balloon.y = 1000\n balloons.append(balloon)\n \n clock += 1\n \n \n \n \n \n # 射擊及計分\n \n # 氣球上升\n # bs = [3, 5, 7, 8, 8, 7, 6]\n w = 0\n for z in balloons:\n if balloons[w].costume_id == 0:\n balloons[w].y -= 3\n if balloons[w].costume_id == 1:\n balloons[w].y -= 5\n if balloons[w].costume_id == 2:\n balloons[w].y -= 7\n if balloons[w].costume_id == 3:\n balloons[w].y -= 8\n if balloons[w].costume_id == 4:\n balloons[w].y -= 8\n if balloons[w].costume_id == 5:\n balloons[w].y -= 7 \n if balloons[w].costume_id == 6:\n balloons[w].y -= 6\n if cursor.is_down and balloons[w].touched(cursor):\n if balloons[w].costume_id == 0:\n scores += 1\n elif balloons[w].costume_id == 1:\n scores += 10\n elif balloons[w].costume_id == 2:\n scores += 5\n elif balloons[w].costume_id == 3:\n scores *= 2 \n elif balloons[w].costume_id == 4:\n scores /= 2\n elif balloons[w].costume_id == 6:\n end += 3\n elif balloons[w].costume_id == 5:\n end -= 10\n \n \n balloons[w].destroy()\n shot.mute(False)\n \n \n w+=1 \n game.draw_text(scores, 60, 20, \"white\", 50)\n # balloons[w].y -= bs[balloon[w].costume_id]\n \n \n # 時間倒數\n \n \n \n if end-time.time() \u003c= 0:\n number.costume_id = 0\n number.hidden = False\n reward.hidden = False\n game.stop()\n elif end - time.time() \u003c= 1:\n number.costume_id = 1\n number.hidden = False\n elif end - time.time() \u003c= 2:\n number.costume_id = 2\n number.hidden = False\n elif end - time.time() \u003c= 3:\n number.costume_id = 3\n number.hidden = False\n elif end - time.time() \u003c= 4:\n number.costume_id = 4\n number.hidden = False\n elif end - time.time() \u003c= 5:\n number.costume_id = 5\n number.hidden = False\n else:\n number.hidden = True\n \n # 遊玩結果\n if scores \u003e 10**10:\n reward.costume_id = 0\n elif scores \u003e 10**9:\n reward.costume_id = 1\n elif scores \u003e 10**8:\n reward.costume_id = 2 \n elif scores \u003e 10**7:\n reward.costume_id = 3\n elif scores \u003e 10**6:\n reward.costume_id = 4 \n elif scores \u003e 10**5:\n reward.costume_id = 5\n elif scores \u003e 10**4:\n reward.costume_id = 6\n elif scores \u003e 10**3:\n reward.costume_id = 7\n elif scores \u003e 10**2:\n reward.costume_id = 8 \n elif scores \u003e 10:\n reward.costume_id = 9\n elif scores \u003e= 0:\n reward.costume_id = 10\ngame.forever(loop)","created_at":"2020-07-22T14:48:48.704+08:00","updated_at":"2020-07-23T14:57:44.666+08:00","name":"射擊氣球_S 副本","language":"python","screenshot":{"url":"https://cdn5.koding.school/uploads/project/screenshot/169411/54fe559750f513594040235cdd9448a7.jpg"},"parent_id":162850,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":61,"hashid":"npmspr4w","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":2927738,"file_name":"e.png","project_id":169411,"asset_id":199817,"created_at":"2020-07-22T14:48:48.717+08:00","updated_at":"2020-07-22T14:48:48.717+08:00"},{"id":2927730,"file_name":"a.png","project_id":169411,"asset_id":199819,"created_at":"2020-07-22T14:48:48.709+08:00","updated_at":"2020-07-22T14:48:48.709+08:00"},{"id":2927731,"file_name":"b.png","project_id":169411,"asset_id":198394,"created_at":"2020-07-22T14:48:48.711+08:00","updated_at":"2020-07-22T14:48:48.711+08:00"},{"id":2927732,"file_name":"bg_1.png","project_id":169411,"asset_id":199814,"created_at":"2020-07-22T14:48:48.712+08:00","updated_at":"2020-07-22T14:48:48.712+08:00"},{"id":2927733,"file_name":"bg_2.png","project_id":169411,"asset_id":199815,"created_at":"2020-07-22T14:48:48.712+08:00","updated_at":"2020-07-22T14:48:48.712+08:00"},{"id":2927734,"file_name":"bgm.mp3","project_id":169411,"asset_id":113696,"created_at":"2020-07-22T14:48:48.713+08:00","updated_at":"2020-07-22T14:48:48.713+08:00"},{"id":2927735,"file_name":"c.png","project_id":169411,"asset_id":198397,"created_at":"2020-07-22T14:48:48.714+08:00","updated_at":"2020-07-22T14:48:48.714+08:00"},{"id":2927736,"file_name":"circle.png","project_id":169411,"asset_id":198061,"created_at":"2020-07-22T14:48:48.715+08:00","updated_at":"2020-07-22T14:48:48.715+08:00"},{"id":2927737,"file_name":"d.png","project_id":169411,"asset_id":199816,"created_at":"2020-07-22T14:48:48.716+08:00","updated_at":"2020-07-22T14:48:48.716+08:00"},{"id":2927739,"file_name":"f.png","project_id":169411,"asset_id":199818,"created_at":"2020-07-22T14:48:48.718+08:00","updated_at":"2020-07-22T14:48:48.718+08:00"},{"id":2927740,"file_name":"g.png","project_id":169411,"asset_id":199810,"created_at":"2020-07-22T14:48:48.719+08:00","updated_at":"2020-07-22T14:48:48.719+08:00"},{"id":2927741,"file_name":"n0.png","project_id":169411,"asset_id":199872,"created_at":"2020-07-22T14:48:48.720+08:00","updated_at":"2020-07-22T14:48:48.720+08:00"},{"id":2927754,"file_name":"r6.png","project_id":169411,"asset_id":199863,"created_at":"2020-07-22T14:48:48.731+08:00","updated_at":"2020-07-22T14:48:48.731+08:00"},{"id":2927742,"file_name":"n1.png","project_id":169411,"asset_id":199873,"created_at":"2020-07-22T14:48:48.720+08:00","updated_at":"2020-07-22T14:48:48.720+08:00"},{"id":2927743,"file_name":"n2.png","project_id":169411,"asset_id":199874,"created_at":"2020-07-22T14:48:48.721+08:00","updated_at":"2020-07-22T14:48:48.721+08:00"},{"id":2927744,"file_name":"n3.png","project_id":169411,"asset_id":199875,"created_at":"2020-07-22T14:48:48.722+08:00","updated_at":"2020-07-22T14:48:48.722+08:00"},{"id":2927745,"file_name":"n4.png","project_id":169411,"asset_id":199876,"created_at":"2020-07-22T14:48:48.723+08:00","updated_at":"2020-07-22T14:48:48.723+08:00"},{"id":2927746,"file_name":"n5.png","project_id":169411,"asset_id":199877,"created_at":"2020-07-22T14:48:48.724+08:00","updated_at":"2020-07-22T14:48:48.724+08:00"},{"id":2927747,"file_name":"pointer.png","project_id":169411,"asset_id":198063,"created_at":"2020-07-22T14:48:48.725+08:00","updated_at":"2020-07-22T14:48:48.725+08:00"},{"id":2927748,"file_name":"r0.png","project_id":169411,"asset_id":199857,"created_at":"2020-07-22T14:48:48.726+08:00","updated_at":"2020-07-22T14:48:48.726+08:00"},{"id":2927749,"file_name":"r1.png","project_id":169411,"asset_id":199858,"created_at":"2020-07-22T14:48:48.727+08:00","updated_at":"2020-07-22T14:48:48.727+08:00"},{"id":2927750,"file_name":"r2.png","project_id":169411,"asset_id":199859,"created_at":"2020-07-22T14:48:48.728+08:00","updated_at":"2020-07-22T14:48:48.728+08:00"},{"id":2927751,"file_name":"r3.png","project_id":169411,"asset_id":199860,"created_at":"2020-07-22T14:48:48.728+08:00","updated_at":"2020-07-22T14:48:48.728+08:00"},{"id":2927752,"file_name":"r4.png","project_id":169411,"asset_id":199861,"created_at":"2020-07-22T14:48:48.729+08:00","updated_at":"2020-07-22T14:48:48.729+08:00"},{"id":2927753,"file_name":"r5.png","project_id":169411,"asset_id":199862,"created_at":"2020-07-22T14:48:48.730+08:00","updated_at":"2020-07-22T14:48:48.730+08:00"},{"id":2927755,"file_name":"r7.png","project_id":169411,"asset_id":199864,"created_at":"2020-07-22T14:48:48.732+08:00","updated_at":"2020-07-22T14:48:48.732+08:00"},{"id":2927756,"file_name":"r8.png","project_id":169411,"asset_id":199865,"created_at":"2020-07-22T14:48:48.733+08:00","updated_at":"2020-07-22T14:48:48.733+08:00"},{"id":2927757,"file_name":"r9.png","project_id":169411,"asset_id":199866,"created_at":"2020-07-22T14:48:48.734+08:00","updated_at":"2020-07-22T14:48:48.734+08:00"},{"id":2927758,"file_name":"r10.png","project_id":169411,"asset_id":199879,"created_at":"2020-07-22T14:48:48.735+08:00","updated_at":"2020-07-22T14:48:48.735+08:00"},{"id":2927759,"file_name":"shot.mp3","project_id":169411,"asset_id":172349,"created_at":"2020-07-22T14:48:48.735+08:00","updated_at":"2020-07-22T14:48:48.735+08:00"},{"id":2927760,"file_name":"target.png","project_id":169411,"asset_id":199868,"created_at":"2020-07-22T14:48:48.736+08:00","updated_at":"2020-07-22T14:48:48.736+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦