{"id":722706,"student_id":1443,"content":"from game import create_sprite, forever, set_backdrop\r\nset_backdrop('bg.png') #設定背景圖\r\ntarget = create_sprite('t_0.png', 't_1.png') #創造目標\r\ntarget.x = 1100 #設定目標水平位置\r\ntarget.y = 300 #設定目標垂直位置\r\nball = create_sprite('ball.png') #創造籃球\r\nball.x = 100 #設定籃球水平位置\r\nball.y = 600 #設定籃球垂直位置\r\n\r\nvx = 10 #水平速度\r\nvy = -3 #垂直速度\r\nstart = False #是否開始移動\r\n\r\ndef gameloop():\r\n global vy, vx, start\r\n \r\n if start:\r\n ball.x = ball.x + vx #根據水平速度移動\r\n ball.y = ball.y + vy #根據垂直速度移動\r\n vy = vy + 0.2\r\n \r\n if ball.touched(target): #如果碰到目標\r\n target.costume_id = 1 #切換綠色造型\r\n \r\n if cursor.is_down:\r\n vx = (cursor.x - ball.x) / 30\r\n vy = (cursor.y - ball.y) / 30\r\n start = True\r\n\r\nforever(gameloop) #不斷執行遊戲迴圈","created_at":"2024-03-30T11:46:28.320+08:00","updated_at":"2025-06-03T20:59:47.787+08:00","name":"投籃_速度與方向_預設 副本","language":"python","screenshot":{"url":"https://cdn8.koding.school/uploads/project/screenshot/722706/d4ed506230475bd450abdbbb0421d7ed.jpg"},"parent_id":452332,"plugin":"","description":null,"note":null,"status":"public","like_student_ids":[],"is_featured":false,"views":93,"hashid":"zpeszvdy6","is_content_changed":false,"review_status":"unsubmitted","submitted_at":null,"reviewed_at":null,"advise":null,"is_deleted":false}
[{"id":16159079,"file_name":"ball.png","project_id":722706,"asset_id":576580,"created_at":"2024-03-30T11:46:28.325+08:00","updated_at":"2024-03-30T11:46:28.325+08:00"},{"id":16159080,"file_name":"t_0.png","project_id":722706,"asset_id":576581,"created_at":"2024-03-30T11:46:28.326+08:00","updated_at":"2024-03-30T11:46:28.326+08:00"},{"id":16159081,"file_name":"t_1.png","project_id":722706,"asset_id":576582,"created_at":"2024-03-30T11:46:28.327+08:00","updated_at":"2024-03-30T11:46:28.327+08:00"},{"id":16159082,"file_name":"bg.png","project_id":722706,"asset_id":576583,"created_at":"2024-03-30T11:46:28.328+08:00","updated_at":"2024-03-30T11:46:28.328+08:00"}]
橘蘋學習平台
我的作品
檢視專案頁
匯出
複製
匯入
刪除
截圖
繁中
简中
English
日本語
用手機掃描下方 QRCode 進行安裝
或您也可以
下載 APK
到這台電腦