1
function love.collide()
if x < 0 then
x = 0
end
if x < love.graphics.getWidth() - Dolphin:getWidth() then
x = love.graphics.getWidth() - Dolphin:getWidth()
end
end
我試圖做一個x座標碰撞,我已經定義了x以前。沒有錯誤,但碰撞失敗。爲什麼這個碰撞代碼不起作用? (love2d)
當我使用getWidth,我得到我的窗口大小的寬度不是對象的寬度。但是,我確實通過將其更改爲函數love.update來獲得此功能 –