How to verify collision with?
Posted: Sat Mar 25, 2023 4:12 pm
Hello, i am having a problem that the collision not is verified, (AABB) collision type
This is the code( only the collision lines )
This is the code( only the collision lines )
Code: Select all
for i = 1, #obj do
if checkCollision(player.x,player.y,player.size,player.size, obj[i].x,obj[i].y,obj[i].size,obj[i].size) then
if obj[i].numeroaleatorio == 8 or obj[i].numeroaleatorio == 5 or obj[i].numeroaleatorio == 15 or obj[i].numeroaleatorio == 18 or obj[i].numeroaleatorio == 9 or obj[i].numeroaleatorio == 1 or obj[i].numeroaleatorio == 20 then
table.remove(collidedwith, i)
pontos = pontos + 1
if pontos >= 6 then win = true gameover = false end
else
if not pontos <= 0 then pontos = pontos - 1 else gameover = true win = false end
end
end
end