{"id":449518,"student_id":10,"content":"from game import create_sprite, forever, set_backdrop\n# set_backdrop('bg.png') #設定背景圖\ntarget = create_sprite('t_0.png', 't_1.png') #創造目標\ntarget.x = 1100 #設定目標水平位置\ntarget.y = 300 #設定目標垂直位置\nball = create_sprite('ball.png') #創造籃球\nball.x = 100 #設定籃球水平位置\nball.y = 600 #設定籃球垂直位置\n\nvx = 0 #水平速度\nvy = 0 #垂直速度\nstart = False #是否開始移動\n\ndef gameloop():\n global vy, vx, start\n \n if start:\n ball.x = ball.x + vx #根據水平速度移動\n ball.y = ball.y + vy #根據垂直速度移動\n vy = vy + 0.2\n \n if ball.touched(target): #如果碰到目標\n target.costume_id = 1 #切換綠色造型\n \n if cursor.is_down:\n vx = (cursor.x - ball.x) / 30\n vy = (cursor.y - ball.y) / 30\n start = True\n\nforever(gameloop) #不斷執行遊戲迴圈","created_at":"2022-10-18T11:38:41.155+08:00","updated_at":"2022-10-21T12:00:13.431+08:00","name":"投籃","language":"python","screenshot":{"url":"https://cdn7.koding.school/uploads/project/screenshot/449518/0da94a507e597a05540ae2f201678d37.jpg"},"parent_id":4,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":123,"hashid":"882s4d2dw","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":10166981,"file_name":"ball.png","project_id":449518,"asset_id":574227,"created_at":"2022-10-18T11:40:56.920+08:00","updated_at":"2022-10-18T11:40:56.920+08:00"},{"id":10167033,"file_name":"t_0.png","project_id":449518,"asset_id":574233,"created_at":"2022-10-18T11:59:50.392+08:00","updated_at":"2022-10-21T10:53:35.131+08:00"},{"id":10167032,"file_name":"t_1.png","project_id":449518,"asset_id":574232,"created_at":"2022-10-18T11:59:50.389+08:00","updated_at":"2022-10-21T10:53:31.718+08:00"},{"id":10173389,"file_name":"bg.png","project_id":449518,"asset_id":574530,"created_at":"2022-10-21T11:16:44.765+08:00","updated_at":"2022-10-21T11:16:44.765+08:00"}]
橘蘋學習平台
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
幫助
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦