• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

GMS 1.4.999 rectangle_in_rectangle HTML5 returns 0 if rectangles overlap completely

pucone

Member
in html5, rectangle_in_rectangle() will return 0 if the two rectangles overlap completely. it should return 1.

if you're having trouble with this, this "fixed" script might help. it will return 0 if the rectangles do not overlap, or 1 if they overlap at all. this does not completely recreate the functionality of rectangle_in_rectangle() but it's a good start!

///rectangle_in_rectangle_fixed(sx1,sy1,sx2,sy2,dx1,dy1,dx2,dy2)
//for html5

var sx1 = argument0;
var sy1 = argument1;
var sx2 = argument2;
var sy2 = argument3;
var dx1 = argument4;
var dy1 = argument5;
var dx2 = argument6;
var dy2 = argument7;

if sx2 > dx1 and
sx1 <= dx2 and
sy2 >= dy1 and
sy1 <= dy2 {
return 1;
} else {
return 0;
}
 
Top