K
Kevin_Sorbo
Guest
Hi Y'all!
Having an issue getting my random spawning coin to stay away from the walls when it spawns. The below code is supposed to spawn ten coins only if they are not near anything. Would appreciate any help you can give. Thanks is advance!
randomize();
{repeat (10) {
var ranx = random(room_width);
var rany = random(room_height);
if point_distance(other.x, other.y, ranx, rany) >= 40 {
instance_create_layer(ranx, rany, "layer_player", obj_coin);
} else {
do {
var ranx = random(room_width);
var rany = random(room_height);
} until point_distance(other.x, other.y, ranx, rany) >= 40;
}
}
}
Having an issue getting my random spawning coin to stay away from the walls when it spawns. The below code is supposed to spawn ten coins only if they are not near anything. Would appreciate any help you can give. Thanks is advance!
randomize();
{repeat (10) {
var ranx = random(room_width);
var rany = random(room_height);
if point_distance(other.x, other.y, ranx, rany) >= 40 {
instance_create_layer(ranx, rany, "layer_player", obj_coin);
} else {
do {
var ranx = random(room_width);
var rany = random(room_height);
} until point_distance(other.x, other.y, ranx, rany) >= 40;
}
}
}