-
Notifications
You must be signed in to change notification settings - Fork 0
Position_free
hpgDesigns edited this page Aug 8, 2021
·
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
This is number 1