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来获得此功能 –