Difference between revisions of "Gb.collideRectRect"

From Gamebuino Wiki
Jump to: navigation, search
m (no collision detection when rectangles only touch without overlapping)
(Example: example added)
 
Line 22: Line 22:
  
 
== Example ==
 
== Example ==
 +
<gistit>https://github.com/Rodot/Gamebuino/blob/beta/libraries/Gamebuino/examples/5.Reference/physics/collideRectRect/collideRectRect.ino</gistit>
  
 
== See also ==
 
== See also ==

Latest revision as of 2014-09-05T22:56:30

Description

Checks if there is a collision (overlapping) between two rectangles.

Syntax

gb.collideRectRect(x1, y1, w1, h1, x2, y2, w2, h2);

Parameters

  • x1: horizontal coordinate of the top left corner of first rectangle.
  • y1: vertical coordinate of the top left corner of first rectangle.
  • w1: width of the first rectangle.
  • h1: height of the first rectangle.
  • x2: horizontal coordinate of the top left corner of the second rectangle.
  • y2: vertical coordinate of the top left corner of the second rectangle.
  • w2: width of the second rectangle.
  • h2: height of the second rectangle.

Returns

  • true: if the two rectangles overlap.
  • false: if the two rectangles don't overlap.

Example

See also