Difference between revisions of "Gb.collideRectRect"

From Gamebuino Wiki
Jump to: navigation, search
(Added description)
 
m (Added the true output for touching rectangles.)
Line 2: Line 2:
 
__NOTOC__
 
__NOTOC__
 
== Description ==
 
== Description ==
Checks if two rectangles overlap.
+
Checks if two rectangles touch or overlap.
  
 
== Syntax ==
 
== Syntax ==
Line 18: Line 18:
  
 
== Returns ==
 
== Returns ==
* true: if the two rectangles overlap
+
* true: if the two rectangles touch or overlap.
* false: if the two rectangles don't overlap.
+
* false: if the two rectangles don't touch and don't overlap.
  
 
== Example ==
 
== Example ==
  
 
== See also ==
 
== See also ==

Revision as of 2014-08-17T20:27:47

Description

Checks if two rectangles touch or overlap.

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 touch or overlap.
  • false: if the two rectangles don't touch and don't overlap.

Example

See also