Fixed snake example after Vector2Angle change.
This commit is contained in:
@@ -110,6 +110,7 @@ function Rectangle:area()
|
||||
return self.width * self.height
|
||||
end
|
||||
|
||||
--- Returns rectangle that fits both rectangles inside it
|
||||
function Rectangle:fit( rec )
|
||||
local pos = Vector2:new( math.min( self.x, rec.x ), math.min( self.y, rec.y ) )
|
||||
|
||||
@@ -121,6 +122,12 @@ function Rectangle:fit( rec )
|
||||
)
|
||||
end
|
||||
|
||||
--- If rectangle is fully inside another rectangle
|
||||
function Rectangle:isInside( rect )
|
||||
return rect.x <= self.x and self.x + self.width <= rect.x + rect.width
|
||||
and rect.y <= self.y and self.y + self.height <= rect.y + rect.height
|
||||
end
|
||||
|
||||
function Rectangle:checkCollisionRec( rec )
|
||||
return RL.CheckCollisionRecs( self, rec )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user