- Primera pasada de reorganització

This commit is contained in:
2026-03-12 17:30:56 +01:00
parent 8f185fa47c
commit 6c5d7a305a
30 changed files with 965 additions and 1096 deletions

View File

@@ -1,26 +1,24 @@
util={
util={}
inside = function(x, y, rectangle)
if x >= rectangle[1] and
y >= rectangle[2] and
x < rectangle[3]+rectangle[1] and
y < rectangle[4]+rectangle[2] then
return true
else
return false
end
end,
aabb = function(sprite)
local x = sprite.pos.x + sprite.bbo.left
local y = sprite.pos.y + sprite.bbo.top
local w = sprite.size.w - sprite.bbo.right - sprite.bbo.left
local h = sprite.size.h - sprite.bbo.bottom - sprite.bbo.top
return x, y, w, h
end,
check_aabb_collision = function(x1,y1,w1,h1, x2,y2,w2,h2)
return ( x1 < x2 + w2 and x1 + w1 > x2 and y1 < y2 + h2 and y1 + h1 > y2 )
function util.inside(x, y, rectangle)
if x >= rectangle[1] and
y >= rectangle[2] and
x < rectangle[3]+rectangle[1] and
y < rectangle[4]+rectangle[2] then
return true
else
return false
end
end
}
function util.aabb(sprite)
local x = sprite.pos.x + sprite.bbo.left
local y = sprite.pos.y + sprite.bbo.top
local w = sprite.size.w - sprite.bbo.right - sprite.bbo.left
local h = sprite.size.h - sprite.bbo.bottom - sprite.bbo.top
return x, y, w, h
end
function util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2)
return ( x1 < x2 + w2 and x1 + w1 > x2 and y1 < y2 + h2 and y1 + h1 > y2 )
end