-
Notifications
You must be signed in to change notification settings - Fork 0
Position_free
hugh greene edited this page Jun 20, 2022
·
1 revision
Checks if there are no instances of a solid object that collide with the given position and returns the result.
Parameter | Data Type | Description |
---|---|---|
x | cs_scalar | x coordinate of the position |
y | cs_scalar | y coordinate of the position |
boolean: Returns whether no instances of a solid object collide with the position.
// demonstrates checking if there is an instance of a solid object at the next position before moving
var mx, my;
mx = x + lengthdir_x(speed, direction);
my = y + lengthdir_y(speed, direction);
if (position_free(mx, my)) {
x = mx;
y = my;
} else {
// there is an instance of a solid object at the next position so we can't move
}
NOTOC
edited by hpg678 on Github